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:
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
@ -190,16 +197,6 @@
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
@ -329,7 +326,8 @@
systemd:
name: ceph-mgr@{{ ansible_hostname }}
state: stopped
enabled: yes
enabled: no
masked: yes
failed_when: false
when:
- not containerized_deployment
@ -351,23 +349,6 @@
- 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:
@ -396,7 +377,8 @@
systemd:
name: ceph-osd@{{ item }}
state: stopped
enabled: yes
enabled: no
masked: yes
with_items: "{{ osd_ids.stdout_lines }}"
when:
- not containerized_deployment
@ -429,6 +411,7 @@
name: ceph-osd@{{ item }}
state: started
enabled: yes
masked: no
with_items: "{{ osd_ids.stdout_lines }}"
when:
- not containerized_deployment
@ -438,6 +421,7 @@
name: "{{ item }}"
state: restarted
enabled: yes
masked: no
daemon_reload: yes
with_items: "{{ osd_names.stdout_lines }}"
when:
@ -544,7 +528,8 @@
systemd:
name: ceph-mds@{{ ansible_hostname }}
state: stopped
enabled: yes
enabled: no
masked: yes
when:
- not containerized_deployment
@ -570,6 +555,7 @@
name: ceph-mds@{{ ansible_hostname }}
state: started
enabled: yes
masked: no
when:
- not containerized_deployment
@ -578,6 +564,7 @@
name: ceph-mds@{{ ansible_hostname }}
state: restarted
enabled: yes
masked: no
daemon_reload: yes
when:
- containerized_deployment
@ -595,7 +582,8 @@
systemd:
name: ceph-radosgw@rgw.{{ ansible_hostname }}
state: stopped
enabled: yes
enabled: no
masked: yes
when:
- not containerized_deployment
@ -621,6 +609,7 @@
name: ceph-radosgw@rgw.{{ ansible_hostname }}
state: started
enabled: yes
masked: no
when:
- not containerized_deployment
@ -629,6 +618,7 @@
name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
state: restarted
enabled: yes
masked: no
daemon_reload: yes
with_items: "{{ rgw_instances }}"
when:
@ -656,7 +646,8 @@
systemd:
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
state: stopped
enabled: yes
enabled: no
masked: yes
failed_when: false
- import_role:
@ -681,6 +672,7 @@
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
state: started
enabled: yes
masked: no
when:
- not containerized_deployment
@ -689,6 +681,7 @@
name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}
state: restarted
enabled: yes
masked: no
daemon_reload: yes
when:
- containerized_deployment
@ -709,7 +702,8 @@
systemd:
name: nfs-ganesha
state: stopped
enabled: yes
enabled: no
masked: yes
failed_when: false
when:
- not containerized_deployment
@ -736,6 +730,7 @@
name: nfs-ganesha
state: started
enabled: yes
masked: no
when:
- not containerized_deployment
- ceph_nfs_enable_service
@ -745,6 +740,7 @@
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
state: restarted
enabled: yes
masked: no
daemon_reload: yes
when:
- ceph_nfs_enable_service
@ -767,7 +763,8 @@
systemd:
name: rbd-target-gw
state: stopped
enabled: yes
enabled: no
masked: yes
failed_when: false
when:
- not containerized_deployment
@ -794,6 +791,7 @@
name: rbd-target-gw
state: started
enabled: yes
masked: no
when:
- not containerized_deployment

View File

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

View File

@ -66,10 +66,12 @@
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

View 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

View File

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

View File

@ -35,4 +35,5 @@
name: ceph-mgr@{{ ansible_hostname }}
state: started
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 }}
state: started
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) }}
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

View 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 }}"

View File

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

View 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
masked: no
changed_when: false

View 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 }}"

View 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