Skip to content

Commit 24406fd

Browse files
johrstromVibe-Guy
andauthored
Dex handler (#272)
* Add service handling and restart handler for ondemand-dex * Extend README with ondemand-dex service variables --------- Co-authored-by: Jens Müller <jens.mueller@unibe.ch>
1 parent 1115271 commit 24406fd

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ See [auth\_openidc](https://github.com/zmartzone/mod_auth_openidc) for more info
294294
#### Install Dex
295295

296296
To install dex for OIDC use set the flag `install_ondemand_dex` to true and it will install the package.
297+
You can use the `ondemand_dex_service_state` and `ondemand_dex_service_enabled` variables in [default/main/install.yml](defaults/main/install.yml#L43) to set the state of the service (default: started / enabled).
297298

298299
### OnDemand.d Configurations
299300

defaults/main/install.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ ood_use_existing_repo_file: false
3939
# flip this flag if you want to install the ondemand-dex RPM
4040
install_ondemand_dex: false
4141
ondemand_dex_package: ondemand-dex # behaviour as for ondemand_package
42+
ondemand_dex_service_name: ondemand-dex
43+
ondemand_dex_service_state: started
44+
ondemand_dex_service_enabled: true
4245

4346
# flip this flag if you want to install the ondemand-selinux RPM
4447
install_ondemand_selinux: false

handlers/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
enabled: "{{ apache_service_enabled }}"
77
become: true
88

9+
- name: Restart ondemand-dex
10+
ansible.builtin.systemd:
11+
name: "{{ ondemand_dex_service_name }}"
12+
state: "{{ 'restarted' if 'started' in ondemand_dex_service_state else omit }}" # effectively makes handler conditional on state=[re]started
13+
enabled: "{{ ondemand_dex_service_enabled }}"
14+
become: true
15+
when: install_ondemand_dex
16+
917
- name: Update nginx stage
1018
ansible.builtin.command: "{{ ood_base_dir }}/nginx_stage/sbin/update_nginx_stage"
1119
become: true

tasks/configure.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
src: "ood_portal.yml.j2"
44
dest: "{{ ood_base_conf_dir }}/ood_portal.yml"
55
mode: 'u=rw,g=r,o='
6-
notify: Restart apache httpd
6+
notify:
7+
- Restart apache httpd
8+
- Restart ondemand-dex
79

810
- name: Template nginx_stage.yml
911
ansible.builtin.template:
@@ -98,3 +100,10 @@
98100
name: "{{ apache_service_name }}"
99101
state: "{{ apache_service_state }}"
100102
enabled: "{{ apache_service_enabled }}"
103+
104+
- name: Start ondemand-dex service if installed
105+
ansible.builtin.systemd:
106+
name: "{{ ondemand_dex_service_name }}"
107+
state: "{{ ondemand_dex_service_state }}"
108+
enabled: "{{ ondemand_dex_service_enabled }}"
109+
when: install_ondemand_dex

0 commit comments

Comments
 (0)