Skip to content

Commit 233f55d

Browse files
committed
handlers: move tmpdir removal
This moves the tmpdir removal tasks to main playbook. The handlers in Ansible are too restrictive and doesn't work quite well for our use case. Signed-off-by: Guillaume Abrioux <[email protected]>
1 parent 7c2cf8c commit 233f55d

File tree

3 files changed

+57
-23
lines changed

3 files changed

+57
-23
lines changed

Diff for: roles/ceph-handler/handlers/main.yml

-23
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,3 @@
6969
or inventory_hostname in groups.get(mds_group_name, [])
7070
or inventory_hostname in groups.get(rgw_group_name, [])
7171
or inventory_hostname in groups.get(rbdmirror_group_name, [])
72-
73-
- name: Remove tempdir for scripts
74-
ansible.builtin.file:
75-
path: "{{ tmpdirpath.path }}"
76-
state: absent
77-
listen:
78-
- "Restart ceph mons"
79-
- "Restart ceph osds"
80-
- "Restart ceph mdss"
81-
- "Restart ceph rgws"
82-
- "Restart ceph rbdmirrors"
83-
- "Restart ceph mgrs"
84-
register: tmpdirpath
85-
when:
86-
- tmpdirpath.path is defined
87-
- not _exporter_handler_called | default(false) | bool
88-
- not _crash_handler_called | default(false) | bool
89-
- not _mds_handler_called | default(false) | bool
90-
- not _mgr_handler_called | default(false) | bool
91-
- not _mon_handler_called | default(false) | bool
92-
- not _osd_handler_called | default(false) | bool
93-
- not _rbdmirror_handler_called | default(false) | bool
94-
- not _rgw_handler_called | default(false) | bool

Diff for: site-container.yml.sample

+29
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,35 @@
469469
status: "Complete"
470470
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
471471

472+
- hosts:
473+
- mons
474+
- osds
475+
- mdss
476+
- rgws
477+
- rbdmirrors
478+
- clients
479+
- mgrs
480+
- monitoring
481+
gather_facts: false
482+
become: True
483+
any_errors_fatal: true
484+
tasks:
485+
- name: Remove tempdir for scripts
486+
ansible.builtin.file:
487+
path: "{{ tmpdirpath.path }}"
488+
state: absent
489+
when:
490+
- tmpdirpath.path is defined
491+
- not _exporter_handler_called | default(false) | bool
492+
- not _crash_handler_called | default(false) | bool
493+
- not _mds_handler_called | default(false) | bool
494+
- not _mgr_handler_called | default(false) | bool
495+
- not _mon_handler_called | default(false) | bool
496+
- not _osd_handler_called | default(false) | bool
497+
- not _rbdmirror_handler_called | default(false) | bool
498+
- not _rgw_handler_called | default(false) | bool
499+
500+
472501
- hosts: mons[0]
473502
gather_facts: false
474503
become: True

Diff for: site.yml.sample

+28
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,34 @@
451451
status: "Complete"
452452
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
453453

454+
- hosts:
455+
- mons
456+
- osds
457+
- mdss
458+
- rgws
459+
- rbdmirrors
460+
- clients
461+
- mgrs
462+
- monitoring
463+
gather_facts: false
464+
become: True
465+
any_errors_fatal: true
466+
tasks:
467+
- name: Remove tempdir for scripts
468+
ansible.builtin.file:
469+
path: "{{ tmpdirpath.path }}"
470+
state: absent
471+
when:
472+
- tmpdirpath.path is defined
473+
- not _exporter_handler_called | default(false) | bool
474+
- not _crash_handler_called | default(false) | bool
475+
- not _mds_handler_called | default(false) | bool
476+
- not _mgr_handler_called | default(false) | bool
477+
- not _mon_handler_called | default(false) | bool
478+
- not _osd_handler_called | default(false) | bool
479+
- not _rbdmirror_handler_called | default(false) | bool
480+
- not _rgw_handler_called | default(false) | bool
481+
454482
- hosts: mons
455483
gather_facts: false
456484
become: True

0 commit comments

Comments
 (0)