]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
handlers: move tmpdir removal
authorGuillaume Abrioux <gabrioux@ibm.com>
Thu, 14 Mar 2024 20:39:45 +0000 (21:39 +0100)
committerSeena Fallah <seenafallah@gmail.com>
Wed, 20 Mar 2024 19:22:34 +0000 (20:22 +0100)
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 <gabrioux@ibm.com>
roles/ceph-handler/handlers/main.yml
site-container.yml.sample
site.yml.sample

index 5f61afe3be13fb0b3a4122ce59b2cc396a69e631..440918c21f8da280fa59e371293f1ef9bae00150 100644 (file)
           or inventory_hostname in groups.get(mds_group_name, [])
           or inventory_hostname in groups.get(rgw_group_name, [])
           or inventory_hostname in groups.get(rbdmirror_group_name, [])
-
-    - name: Remove tempdir for scripts
-      ansible.builtin.file:
-        path: "{{ tmpdirpath.path }}"
-        state: absent
-      listen:
-        - "Restart ceph mons"
-        - "Restart ceph osds"
-        - "Restart ceph mdss"
-        - "Restart ceph rgws"
-        - "Restart ceph rbdmirrors"
-        - "Restart ceph mgrs"
-      register: tmpdirpath
-      when:
-        - tmpdirpath.path is defined
-        - not _exporter_handler_called | default(false) | bool
-        - not _crash_handler_called | default(false) | bool
-        - not _mds_handler_called | default(false) | bool
-        - not _mgr_handler_called | default(false) | bool
-        - not _mon_handler_called | default(false) | bool
-        - not _osd_handler_called | default(false) | bool
-        - not _rbdmirror_handler_called | default(false) | bool
-        - not _rgw_handler_called | default(false) | bool
index 08c31750017860ca7cb648f59da9e462ff5d2023..0c8de0e0ab810f8f3d28ce13e004cae18737965d 100644 (file)
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
+- hosts:
+  - mons
+  - osds
+  - mdss
+  - rgws
+  - rbdmirrors
+  - clients
+  - mgrs
+  - monitoring
+  gather_facts: false
+  become: True
+  any_errors_fatal: true
+  tasks:
+    - name: Remove tempdir for scripts
+      ansible.builtin.file:
+        path: "{{ tmpdirpath.path }}"
+        state: absent
+      when:
+        - tmpdirpath.path is defined
+        - not _exporter_handler_called | default(false) | bool
+        - not _crash_handler_called | default(false) | bool
+        - not _mds_handler_called | default(false) | bool
+        - not _mgr_handler_called | default(false) | bool
+        - not _mon_handler_called | default(false) | bool
+        - not _osd_handler_called | default(false) | bool
+        - not _rbdmirror_handler_called | default(false) | bool
+        - not _rgw_handler_called | default(false) | bool
+
+
 - hosts: mons[0]
   gather_facts: false
   become: True
index fd67deba6ce6d9d2e7aa8ad65a0a39732bfc580a..ef1234bc5245eb8e1c54c5e92fc3a6bb3de2294a 100644 (file)
             status: "Complete"
             end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
 
+- hosts:
+  - mons
+  - osds
+  - mdss
+  - rgws
+  - rbdmirrors
+  - clients
+  - mgrs
+  - monitoring
+  gather_facts: false
+  become: True
+  any_errors_fatal: true
+  tasks:
+    - name: Remove tempdir for scripts
+      ansible.builtin.file:
+        path: "{{ tmpdirpath.path }}"
+        state: absent
+      when:
+        - tmpdirpath.path is defined
+        - not _exporter_handler_called | default(false) | bool
+        - not _crash_handler_called | default(false) | bool
+        - not _mds_handler_called | default(false) | bool
+        - not _mgr_handler_called | default(false) | bool
+        - not _mon_handler_called | default(false) | bool
+        - not _osd_handler_called | default(false) | bool
+        - not _rbdmirror_handler_called | default(false) | bool
+        - not _rgw_handler_called | default(false) | bool
+
 - hosts: mons
   gather_facts: false
   become: True