Skip to content

Commit bb0addf

Browse files
committed
moving enable status to handlers to prevent race conditions when managing service that are not done configuring
1 parent d7a5f73 commit bb0addf

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

handlers/main.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33
systemd:
44
name: "{{item.name}}.service"
55
state: started
6-
daemon_reload: yes
6+
enabled: "{{item.enable|default(no)}}"
77
with_items: "{{celery_services}}"
88

99
- name: "restart celery services"
1010
systemd:
1111
name: "{{item.name}}.service"
1212
state: restarted
13-
daemon_reload: yes
13+
enabled: "{{item.enable|default(no)}}"
1414
with_items: "{{celery_services}}"
1515

1616
- name: "stop celery services"
1717
systemd:
1818
name: "{{item.name}}.service"
1919
state: stopped
20-
daemon_reload: yes
2120
with_items: "{{celery_services}}"

tasks/manage_units.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,3 @@
4747
systemd:
4848
daemon_reload: yes
4949
when: celery_services_state is changed
50-
51-
- name: Enable Service
52-
systemd:
53-
name: "{{item.name}}.service"
54-
state: "{{item.state|default('stopped')}}"
55-
enabled: yes
56-
when: item.enabled|default(False)|bool
57-
with_items: "{{celery_services}}"

0 commit comments

Comments
 (0)