]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
update: mask systemd service units during upgrade
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 20 Mar 2019 10:35:36 +0000 (11:35 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Mon, 25 Mar 2019 20:02:56 +0000 (16:02 -0400)
This prevents the packaging from restarting services before we do need
to restart them in the rolling update sequence.
We want to handle services restart at rolling_update playbook.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
13 files changed:
infrastructure-playbooks/rolling_update.yml
roles/ceph-iscsi-gw/tasks/container/containerized.yml
roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml
roles/ceph-mds/tasks/containerized.yml
roles/ceph-mds/tasks/non_containerized.yml
roles/ceph-mgr/tasks/start_mgr.yml
roles/ceph-mon/tasks/start_monitor.yml
roles/ceph-nfs/tasks/start_nfs.yml
roles/ceph-osd/tasks/start_osds.yml
roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml
roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml
roles/ceph-rgw/tasks/docker/start_docker_rgw.yml
roles/ceph-rgw/tasks/start_radosgw.yml

index 15eee8f6e719042f768b2131b229684f00572443..7ee831ce0ddeb2ad4b6e86c101404d371b1ce197 100644 (file)
       set_fact:
         mon_host: "{{ groups[mon_group_name] | difference([inventory_hostname]) | last }}"
 
+    # NOTE: we mask the service so the RPM can't restart it
+    # after the package gets upgraded
     - name: stop ceph mon - shortname
       systemd:
         name: ceph-mon@{{ ansible_hostname }}
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       ignore_errors: True
       when:
         - not containerized_deployment
 
+    # NOTE: we mask the service so the RPM can't restart it
+    # after the package gets upgraded
     - name: stop ceph mon - fqdn
       systemd:
         name: ceph-mon@{{ ansible_fqdn }}
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       ignore_errors: True
       when:
         - not containerized_deployment
 
-    - name: stop ceph mgr
+    # only mask the service for mgr because it must be upgraded
+    # after ALL monitors, even when collocated
+    - name: mask the mgr service
       systemd:
         name: ceph-mgr@{{ ansible_hostname }}
-        state: stopped
-        enabled: yes
-      ignore_errors: True # if no mgr collocated with mons
+        masked: yes
       when:
-        - not containerized_deployment
+        - inventory_hostname in groups[mgr_group_name]
+          or groups[mgr_group_name] | length == 0
 
     - import_role:
         name: ceph-defaults
       when:
         - containerized_deployment
 
-    - name: restart containerized ceph mgr
-      systemd:
-        name: ceph-mgr@{{ monitor_name }}
-        state: restarted
-        enabled: yes
-        daemon_reload: yes
-      ignore_errors: True # if no mgr collocated with mons
-      when:
-        - containerized_deployment
-
     - name: non container | waiting for the monitor to join the quorum...
       command: ceph --cluster "{{ cluster }}" -s --format json
       register: ceph_health_raw
       systemd:
         name: ceph-mgr@{{ ansible_hostname }}
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       failed_when: false
       when:
         - not containerized_deployment
     - import_role:
         name: ceph-mgr
 
-    - name: start ceph mgr
-      systemd:
-        name: ceph-mgr@{{ ansible_hostname }}
-        state: started
-        enabled: yes
-      when:
-        - not containerized_deployment
-
-    - name: restart containerized ceph mgr
-      systemd:
-        name: ceph-mgr@{{ ansible_hostname }}
-        state: restarted
-        enabled: yes
-        daemon_reload: yes
-      when:
-        - containerized_deployment
-
 
 - name: upgrade ceph osds cluster
   vars:
       systemd:
         name: ceph-osd@{{ item }}
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       with_items: "{{ osd_ids.stdout_lines }}"
       when:
         - not containerized_deployment
         name: ceph-osd@{{ item }}
         state: started
         enabled: yes
+        masked: no
       with_items: "{{ osd_ids.stdout_lines }}"
       when:
         - not containerized_deployment
         name: "{{ item }}"
         state: restarted
         enabled: yes
+        masked: no
         daemon_reload: yes
       with_items: "{{ osd_names.stdout_lines }}"
       when:
       systemd:
         name: ceph-mds@{{ ansible_hostname }}
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       when:
         - not containerized_deployment
 
         name: ceph-mds@{{ ansible_hostname }}
         state: started
         enabled: yes
+        masked: no
       when:
         - not containerized_deployment
 
         name: ceph-mds@{{ ansible_hostname }}
         state: restarted
         enabled: yes
+        masked: no
         daemon_reload: yes
       when:
         - containerized_deployment
       systemd:
         name: ceph-radosgw@rgw.{{ ansible_hostname }}
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       when:
         - not containerized_deployment
 
         name: ceph-radosgw@rgw.{{ ansible_hostname }}
         state: started
         enabled: yes
+        masked: no
       when:
         - not containerized_deployment
 
         name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
         state: restarted
         enabled: yes
+        masked: no
         daemon_reload: yes
       with_items: "{{ rgw_instances }}"
       when:
       systemd:
         name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       failed_when: false
 
     - import_role:
         name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
         state: started
         enabled: yes
+        masked: no
       when:
         - not containerized_deployment
 
         name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}
         state: restarted
         enabled: yes
+        masked: no
         daemon_reload: yes
       when:
         - containerized_deployment
       systemd:
         name: nfs-ganesha
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       failed_when: false
       when:
         - not containerized_deployment
         name: nfs-ganesha
         state: started
         enabled: yes
+        masked: no
       when:
         - not containerized_deployment
         - ceph_nfs_enable_service
         name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
         state: restarted
         enabled: yes
+        masked: no
         daemon_reload: yes
       when:
         - ceph_nfs_enable_service
       systemd:
         name: rbd-target-gw
         state: stopped
-        enabled: yes
+        enabled: no
+        masked: yes
       failed_when: false
       when:
         - not containerized_deployment
         name: rbd-target-gw
         state: started
         enabled: yes
+        masked: no
       when:
         - not containerized_deployment
 
index a7316c475bab790c2136fc81c7d9503f9dd95089..7610d2bde06aac30af2f8e1285a0e6cb18b104f8 100644 (file)
@@ -19,6 +19,7 @@
     name: "{{ item }}"
     state: started
     enabled: yes
+    masked: no
     daemon_reload: yes
   with_items:
     - tcmu-runner
index 3fa2dbbdd83990da71b812276b417d0f5b05d024..cbd7d002f49730365ec5da297a7eb9d39c321e0b 100644 (file)
   service:
     name: rbd-target-gw
     enabled: yes
+    masked: no
     state: started
 
 - name: enable the rbd-target-api service and make sure it is running
   service:
     name: rbd-target-api
     enabled: yes
+    masked: no
     state: started
index 944010bca57438f377598516ec59d68136db6648..c59ceb14ca77eec0e3b1fc75adb99094e1881c3d 100644 (file)
@@ -61,6 +61,7 @@
     name: ceph-mds@{{ ansible_hostname }}
     state: started
     enabled: yes
+    masked: no
     daemon_reload: yes
 
 - name: wait for mds socket to exist
index d0c77a338f0661d44313b891dc5b5155171ffa2c..94123980f0fbfc4ea8d67c8dd40d61c843e8658a 100644 (file)
@@ -58,4 +58,5 @@
     name: ceph-mds@{{ mds_name }}
     state: started
     enabled: yes
+    masked: no
   changed_when: false
index 19c1c8b0cbb2abf69bbe45a8cb5fa9af9b9abe8e..3d7fa36256580d5b181def99b7a3f4472d301909 100644 (file)
@@ -35,4 +35,5 @@
     name: ceph-mgr@{{ ansible_hostname }}
     state: started
     enabled: yes
-    daemon_reload: yes
\ No newline at end of file
+    masked: no
+    daemon_reload: yes
index e5d2d238731ddb7c947dfed15f184f007317e8b0..b1be39945c29471aed25f7d34f8126f6d2df4494 100644 (file)
@@ -36,4 +36,5 @@
     name: ceph-mon@{{ monitor_name if not containerized_deployment else ansible_hostname }}
     state: started
     enabled: yes
-    daemon_reload: yes
\ No newline at end of file
+    masked: no
+    daemon_reload: yes
index 8a0a7d507e4b400d8b45f41b32ac1c493391a5c4..6536881ea12df4cb3ffbac4c65067b9861bccc42 100644 (file)
@@ -83,6 +83,7 @@
     name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
     state: started
     enabled: yes
+    masked: no
     daemon_reload: yes
   when:
     - containerized_deployment
@@ -93,6 +94,7 @@
     name: nfs-ganesha
     state: started
     enabled: yes
+    masked: no
   when:
     - not containerized_deployment
     - ceph_nfs_enable_service
index 5460a5e574e385b29cdb68305ec997c8ed81e68a..06215f20ff0a3ac5076c5d3121ea49e5e84538ef 100644 (file)
@@ -76,6 +76,7 @@
     name: ceph-osd@{{ item | regex_replace('/dev/', '') if osd_scenario != 'lvm' and containerized_deployment else item }}
     state: started
     enabled: yes
+    masked: no
     daemon_reload: yes
   with_items: "{{ devices if osd_scenario != 'lvm' and containerized_deployment else ((ceph_osd_ids.stdout | from_json).keys() | list) if osd_scenario == 'lvm' and not containerized_deployment else osd_ids_non_container.stdout_lines }}"
 
index 6bb2844f621330272275208323852d4077f7b3bc..68432bd1dd35bc432543b4f5f27beb35103dc039 100644 (file)
@@ -16,4 +16,5 @@
     name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}
     state: started
     enabled: yes
-    daemon_reload: yes
\ No newline at end of file
+    masked: no
+    daemon_reload: yes
index 6c3d11c620ca1fc8fc479a71a313fedf5beacebc..70140c5d138634f44cf19a7d5f9d6e155dd250bd 100644 (file)
@@ -29,6 +29,7 @@
     name: "ceph-rbd-mirror.target"
     state: started
     enabled: yes
+    masked: no
   changed_when: false
 
 - name: start and add the rbd-mirror service instance
@@ -36,4 +37,5 @@
     name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
     state: started
     enabled: yes
-  changed_when: false
No newline at end of file
+    masked: no
 changed_when: false
index 90db90925b000328875dd61741c3fcf886f71d7c..994a6dbb715797299e6f1935b426dcd5fde8d220 100644 (file)
@@ -28,6 +28,7 @@
     name: "{{ item }}"
     state: stopped
     enabled: no
+    masked: yes
     daemon_reload: yes
   with_items:
     - "ceph-rgw@{{ ansible_hostname }}"
@@ -41,5 +42,6 @@
     name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
     state: started
     enabled: yes
+    masked: no
     daemon_reload: yes
   with_items: "{{ rgw_instances }}"
index 4bac51cc1cbe031803484d494e294241f9104c39..0419c1247889f242a01521f54cf3bb818c307199 100644 (file)
@@ -20,6 +20,7 @@
     name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
     state: started
     enabled: yes
+    masked: no
   with_items: "{{ rgw_instances }}"
 
 - name: enable the ceph-radosgw.target service