Skip to content

Commit dfc3a42

Browse files
committed
Reload systemd when service changes
1 parent 9a25802 commit dfc3a42

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

tasks/main.yml

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22

33
- name: Create the directories for site specific configurations
4-
user:
4+
user:
55
name="{{ oauth2_user }}"
66
shell="/bin/false"
77
home="{{ oauth2_dir }}"
88

99
- name: Create the directories for site specific configurations
10-
file:
10+
file:
1111
path="{{ item }}"
1212
state=directory
1313
owner="{{ oauth2_user }}"
@@ -26,37 +26,44 @@
2626
owner="{{ oauth2_user }}"
2727

2828
- name: unarchive oauth2 binary
29-
unarchive:
29+
unarchive:
3030
src="{{ oauth2_dir_tmp }}/{{ oauth2_compress_filename }}"
3131
dest="{{ oauth2_dir }}/"
3232
creates="{{ oauth2_dir }}/{{ oauth2_compress_filename }}"
3333
copy=no
3434

3535
- name: Create current symlink
36-
file:
36+
file:
3737
src="{{ oauth2_dir }}/{{ oauth2_filename }}"
3838
dest="{{ oauth2_dir }}/current"
3939
owner="{{ oauth2_user }}"
4040
mode="0755"
4141
state="link"
42-
notify:
42+
notify:
4343
- oauth2-proxy restart
4444

4545
- name: Deploy init.d script
46-
template:
46+
template:
4747
src="init.d.sh.j2.sh"
4848
dest="/etc/init.d/oauth2-proxy"
4949
mode="0755"
50-
notify:
50+
register: initd_script
51+
notify:
5152
- oauth2-proxy restart
5253

54+
- name: Reload Systemd
55+
systemd:
56+
daemon_reload=yes
57+
name=oauth2-proxy
58+
when: initd_script.changed and ansible_service_mgr == 'systemd'
59+
5360
- name: Deploy Config
54-
template:
61+
template:
5562
src="config.j2"
5663
dest="{{ oauth2_config_path }}"
5764
owner="{{ oauth2_user }}"
5865
mode="0600"
59-
notify:
66+
notify:
6067
- oauth2-proxy restart
6168

6269
- name: Service start

0 commit comments

Comments
 (0)