From e1594768c3bfddfaab2edb40df1c9ec9f4dcfc11 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Tue, 10 Dec 2024 13:59:23 -0500 Subject: [PATCH 1/2] more flexible ondemand.d configurations. This allows for more flexible ondemand.d configurations. Instead of this role supplying all configurations in one single file, users can define a yaml structure that will create specific files for each feature while also being able to specify group and file permissions on the file. --- defaults/main/ondemand.yml | 2 ++ molecule/default/fixtures/ondemand.d/motd.yml | 1 + .../default/fixtures/ondemand.d/ondemand_custom.yml | 2 -- molecule/default/tasks/verify_custom.yml | 2 ++ molecule/default/vars/ondemand.yml | 5 ++++- tasks/configure.yml | 10 ++++++++++ 6 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 molecule/default/fixtures/ondemand.d/motd.yml diff --git a/defaults/main/ondemand.yml b/defaults/main/ondemand.yml index e8470cf..d923ea9 100644 --- a/defaults/main/ondemand.yml +++ b/defaults/main/ondemand.yml @@ -93,3 +93,5 @@ hide_app_version: false # google_analytics_tag_id: null motd_render_html: false + +# ood_ondemand_d_configs: {} \ No newline at end of file diff --git a/molecule/default/fixtures/ondemand.d/motd.yml b/molecule/default/fixtures/ondemand.d/motd.yml new file mode 100644 index 0000000..62f5492 --- /dev/null +++ b/molecule/default/fixtures/ondemand.d/motd.yml @@ -0,0 +1 @@ +motd_render_html: true diff --git a/molecule/default/fixtures/ondemand.d/ondemand_custom.yml b/molecule/default/fixtures/ondemand.d/ondemand_custom.yml index 7b7b5e4..51ea1ff 100644 --- a/molecule/default/fixtures/ondemand.d/ondemand_custom.yml +++ b/molecule/default/fixtures/ondemand.d/ondemand_custom.yml @@ -72,5 +72,3 @@ globus_endpoints: google_analytics_tag_id: abc123 - -motd_render_html: true diff --git a/molecule/default/tasks/verify_custom.yml b/molecule/default/tasks/verify_custom.yml index a51bccc..982c2f5 100644 --- a/molecule/default/tasks/verify_custom.yml +++ b/molecule/default/tasks/verify_custom.yml @@ -11,6 +11,7 @@ - { src: "fixtures/apps/bc_desktop/", dest: "bc_desktop/" } - { src: "fixtures/config/auth_openidc.conf", dest: "auth_openidc.conf" } - { src: "fixtures/ondemand.d/ondemand_custom.yml", dest: "ondemand.yml" } + - { src: "fixtures/ondemand.d/motd.yml", dest: "motd.yml" } - name: Verify config files ansible.builtin.command: "diff /tmp/{{ item.left }} {{ item.right }}" @@ -23,6 +24,7 @@ - { left: "bc_desktop/submit/submit.yml.erb", right: "{{ ood_base_conf_dir }}/apps/bc_desktop/submit/submit.yml.erb" } - { left: "auth_openidc.conf", right: "{{ apache_conf_dir }}/auth_openidc.conf" } - { left: "ondemand.yml", right: "{{ ood_base_conf_dir }}/ondemand.d/ondemand.yml" } + - { left: "motd.yml", right: "{{ ood_base_conf_dir }}/ondemand.d/motd.yml" } changed_when: false - name: Verify sys/jupyter was installed correctly diff --git a/molecule/default/vars/ondemand.yml b/molecule/default/vars/ondemand.yml index cec82e8..b1527e9 100644 --- a/molecule/default/vars/ondemand.yml +++ b/molecule/default/vars/ondemand.yml @@ -65,4 +65,7 @@ globus_endpoints: google_analytics_tag_id: 'abc123' -motd_render_html: true +ood_ondemand_d_configs: + motd: + content: + motd_render_html: true diff --git a/tasks/configure.yml b/tasks/configure.yml index c40e9d8..83f2839 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -35,6 +35,16 @@ dest: "{{ ood_base_conf_dir }}/ondemand.d/ondemand.yml" mode: 'u=rw,g=r,o=r' +- name: Create other ondemand.d files + copy: + content: "{{ ood_ondemand_d_configs[item].content | to_nice_yaml }}" + dest: "{{ ood_base_conf_dir }}/ondemand.d/{{ item }}.yml" + mode: "{{ ood_ondemand_d_configs[item].mode | default('644') }}" + group: "{{ ood_ondemand_d_configs[item].group | default('root') }}" + loop: "{{ ood_ondemand_d_configs | list | default([]) }}" + when: ood_ondemand_d_configs is defined + + - name: Enable Debian apache mods ansible.builtin.file: src: "{{ apache_etc_dir }}/mods-available/{{ item }}.load" From 749e2e271b6b60a0f1ec76a7a97e14e150237362 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 11 Dec 2024 11:04:37 -0500 Subject: [PATCH 2/2] fix this test --- molecule/default/fixtures/ondemand.d/ondemand_custom.yml | 2 ++ molecule/default/vars/ondemand.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/molecule/default/fixtures/ondemand.d/ondemand_custom.yml b/molecule/default/fixtures/ondemand.d/ondemand_custom.yml index 51ea1ff..7b7b5e4 100644 --- a/molecule/default/fixtures/ondemand.d/ondemand_custom.yml +++ b/molecule/default/fixtures/ondemand.d/ondemand_custom.yml @@ -72,3 +72,5 @@ globus_endpoints: google_analytics_tag_id: abc123 + +motd_render_html: true diff --git a/molecule/default/vars/ondemand.yml b/molecule/default/vars/ondemand.yml index b1527e9..68a715b 100644 --- a/molecule/default/vars/ondemand.yml +++ b/molecule/default/vars/ondemand.yml @@ -65,6 +65,8 @@ globus_endpoints: google_analytics_tag_id: 'abc123' +motd_render_html: true + ood_ondemand_d_configs: motd: content: