update: mask systemd service units during upgrade

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>
pull/3748/head
Guillaume Abrioux 2019-03-20 11:35:36 +01:00 committed by Dimitri Savineau
parent 8add55451c
commit 82764afe8d
13 changed files with 59 additions and 45 deletions

View File

@ -96,32 +96,39 @@
set_fact: set_fact:
mon_host: "{{ groups[mon_group_name] | difference([inventory_hostname]) | last }}" 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 - name: stop ceph mon - shortname
systemd: systemd:
name: ceph-mon@{{ ansible_hostname }} name: ceph-mon@{{ ansible_hostname }}
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
ignore_errors: True ignore_errors: True
when: when:
- not containerized_deployment - 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 - name: stop ceph mon - fqdn
systemd: systemd:
name: ceph-mon@{{ ansible_fqdn }} name: ceph-mon@{{ ansible_fqdn }}
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
ignore_errors: True ignore_errors: True
when: when:
- not containerized_deployment - 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: systemd:
name: ceph-mgr@{{ ansible_hostname }} name: ceph-mgr@{{ ansible_hostname }}
state: stopped masked: yes
enabled: yes
ignore_errors: True # if no mgr collocated with mons
when: when:
- not containerized_deployment - inventory_hostname in groups[mgr_group_name]
or groups[mgr_group_name] | length == 0
- import_role: - import_role:
name: ceph-defaults name: ceph-defaults
@ -190,16 +197,6 @@
when: when:
- containerized_deployment - 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... - name: non container | waiting for the monitor to join the quorum...
command: ceph --cluster "{{ cluster }}" -s --format json command: ceph --cluster "{{ cluster }}" -s --format json
register: ceph_health_raw register: ceph_health_raw
@ -329,7 +326,8 @@
systemd: systemd:
name: ceph-mgr@{{ ansible_hostname }} name: ceph-mgr@{{ ansible_hostname }}
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
failed_when: false failed_when: false
when: when:
- not containerized_deployment - not containerized_deployment
@ -351,23 +349,6 @@
- import_role: - import_role:
name: ceph-mgr 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 - name: upgrade ceph osds cluster
vars: vars:
@ -396,7 +377,8 @@
systemd: systemd:
name: ceph-osd@{{ item }} name: ceph-osd@{{ item }}
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
with_items: "{{ osd_ids.stdout_lines }}" with_items: "{{ osd_ids.stdout_lines }}"
when: when:
- not containerized_deployment - not containerized_deployment
@ -429,6 +411,7 @@
name: ceph-osd@{{ item }} name: ceph-osd@{{ item }}
state: started state: started
enabled: yes enabled: yes
masked: no
with_items: "{{ osd_ids.stdout_lines }}" with_items: "{{ osd_ids.stdout_lines }}"
when: when:
- not containerized_deployment - not containerized_deployment
@ -438,6 +421,7 @@
name: "{{ item }}" name: "{{ item }}"
state: restarted state: restarted
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
with_items: "{{ osd_names.stdout_lines }}" with_items: "{{ osd_names.stdout_lines }}"
when: when:
@ -544,7 +528,8 @@
systemd: systemd:
name: ceph-mds@{{ ansible_hostname }} name: ceph-mds@{{ ansible_hostname }}
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
when: when:
- not containerized_deployment - not containerized_deployment
@ -570,6 +555,7 @@
name: ceph-mds@{{ ansible_hostname }} name: ceph-mds@{{ ansible_hostname }}
state: started state: started
enabled: yes enabled: yes
masked: no
when: when:
- not containerized_deployment - not containerized_deployment
@ -578,6 +564,7 @@
name: ceph-mds@{{ ansible_hostname }} name: ceph-mds@{{ ansible_hostname }}
state: restarted state: restarted
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
when: when:
- containerized_deployment - containerized_deployment
@ -595,7 +582,8 @@
systemd: systemd:
name: ceph-radosgw@rgw.{{ ansible_hostname }} name: ceph-radosgw@rgw.{{ ansible_hostname }}
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
when: when:
- not containerized_deployment - not containerized_deployment
@ -621,6 +609,7 @@
name: ceph-radosgw@rgw.{{ ansible_hostname }} name: ceph-radosgw@rgw.{{ ansible_hostname }}
state: started state: started
enabled: yes enabled: yes
masked: no
when: when:
- not containerized_deployment - not containerized_deployment
@ -629,6 +618,7 @@
name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }} name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
state: restarted state: restarted
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
with_items: "{{ rgw_instances }}" with_items: "{{ rgw_instances }}"
when: when:
@ -656,7 +646,8 @@
systemd: systemd:
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}" name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
failed_when: false failed_when: false
- import_role: - import_role:
@ -681,6 +672,7 @@
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}" name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
state: started state: started
enabled: yes enabled: yes
masked: no
when: when:
- not containerized_deployment - not containerized_deployment
@ -689,6 +681,7 @@
name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }} name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}
state: restarted state: restarted
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
when: when:
- containerized_deployment - containerized_deployment
@ -709,7 +702,8 @@
systemd: systemd:
name: nfs-ganesha name: nfs-ganesha
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
failed_when: false failed_when: false
when: when:
- not containerized_deployment - not containerized_deployment
@ -736,6 +730,7 @@
name: nfs-ganesha name: nfs-ganesha
state: started state: started
enabled: yes enabled: yes
masked: no
when: when:
- not containerized_deployment - not containerized_deployment
- ceph_nfs_enable_service - ceph_nfs_enable_service
@ -745,6 +740,7 @@
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }} name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
state: restarted state: restarted
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
when: when:
- ceph_nfs_enable_service - ceph_nfs_enable_service
@ -767,7 +763,8 @@
systemd: systemd:
name: rbd-target-gw name: rbd-target-gw
state: stopped state: stopped
enabled: yes enabled: no
masked: yes
failed_when: false failed_when: false
when: when:
- not containerized_deployment - not containerized_deployment
@ -794,6 +791,7 @@
name: rbd-target-gw name: rbd-target-gw
state: started state: started
enabled: yes enabled: yes
masked: no
when: when:
- not containerized_deployment - not containerized_deployment

View File

@ -19,6 +19,7 @@
name: "{{ item }}" name: "{{ item }}"
state: started state: started
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
with_items: with_items:
- tcmu-runner - tcmu-runner

View File

@ -66,10 +66,12 @@
service: service:
name: rbd-target-gw name: rbd-target-gw
enabled: yes enabled: yes
masked: no
state: started state: started
- name: enable the rbd-target-api service and make sure it is running - name: enable the rbd-target-api service and make sure it is running
service: service:
name: rbd-target-api name: rbd-target-api
enabled: yes enabled: yes
masked: no
state: started state: started

View File

@ -61,6 +61,7 @@
name: ceph-mds@{{ ansible_hostname }} name: ceph-mds@{{ ansible_hostname }}
state: started state: started
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
- name: wait for mds socket to exist - name: wait for mds socket to exist

View File

@ -58,4 +58,5 @@
name: ceph-mds@{{ mds_name }} name: ceph-mds@{{ mds_name }}
state: started state: started
enabled: yes enabled: yes
masked: no
changed_when: false changed_when: false

View File

@ -35,4 +35,5 @@
name: ceph-mgr@{{ ansible_hostname }} name: ceph-mgr@{{ ansible_hostname }}
state: started state: started
enabled: yes enabled: yes
daemon_reload: yes masked: no
daemon_reload: yes

View File

@ -36,4 +36,5 @@
name: ceph-mon@{{ monitor_name if not containerized_deployment else ansible_hostname }} name: ceph-mon@{{ monitor_name if not containerized_deployment else ansible_hostname }}
state: started state: started
enabled: yes enabled: yes
daemon_reload: yes masked: no
daemon_reload: yes

View File

@ -83,6 +83,7 @@
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }} name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
state: started state: started
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
when: when:
- containerized_deployment - containerized_deployment
@ -93,6 +94,7 @@
name: nfs-ganesha name: nfs-ganesha
state: started state: started
enabled: yes enabled: yes
masked: no
when: when:
- not containerized_deployment - not containerized_deployment
- ceph_nfs_enable_service - ceph_nfs_enable_service

View File

@ -76,6 +76,7 @@
name: ceph-osd@{{ item | regex_replace('/dev/', '') if osd_scenario != 'lvm' and containerized_deployment else item }} name: ceph-osd@{{ item | regex_replace('/dev/', '') if osd_scenario != 'lvm' and containerized_deployment else item }}
state: started state: started
enabled: yes enabled: yes
masked: no
daemon_reload: yes 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 }}" 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 }}"

View File

@ -16,4 +16,5 @@
name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }} name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}
state: started state: started
enabled: yes enabled: yes
daemon_reload: yes masked: no
daemon_reload: yes

View File

@ -29,6 +29,7 @@
name: "ceph-rbd-mirror.target" name: "ceph-rbd-mirror.target"
state: started state: started
enabled: yes enabled: yes
masked: no
changed_when: false changed_when: false
- name: start and add the rbd-mirror service instance - name: start and add the rbd-mirror service instance
@ -36,4 +37,5 @@
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}" name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
state: started state: started
enabled: yes enabled: yes
changed_when: false masked: no
changed_when: false

View File

@ -28,6 +28,7 @@
name: "{{ item }}" name: "{{ item }}"
state: stopped state: stopped
enabled: no enabled: no
masked: yes
daemon_reload: yes daemon_reload: yes
with_items: with_items:
- "ceph-rgw@{{ ansible_hostname }}" - "ceph-rgw@{{ ansible_hostname }}"
@ -41,5 +42,6 @@
name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }} name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
state: started state: started
enabled: yes enabled: yes
masked: no
daemon_reload: yes daemon_reload: yes
with_items: "{{ rgw_instances }}" with_items: "{{ rgw_instances }}"

View File

@ -20,6 +20,7 @@
name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }} name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
state: started state: started
enabled: yes enabled: yes
masked: no
with_items: "{{ rgw_instances }}" with_items: "{{ rgw_instances }}"
- name: enable the ceph-radosgw.target service - name: enable the ceph-radosgw.target service