mirror of https://github.com/ceph/ceph-ansible.git
rolling update: add systemd support
Signed-off-by: Sébastien Han <seb@redhat.com>pull/826/head
parent
e0d1c66a59
commit
217ce3cad0
|
@ -28,9 +28,30 @@
|
||||||
invoking the playbook"
|
invoking the playbook"
|
||||||
when: ireallymeanit != 'yes'
|
when: ireallymeanit != 'yes'
|
||||||
|
|
||||||
- hosts: all
|
- hosts:
|
||||||
|
- mons
|
||||||
|
- osds
|
||||||
|
- mdss
|
||||||
|
- rgws
|
||||||
|
|
||||||
|
become: True
|
||||||
tasks:
|
tasks:
|
||||||
- debug: msg="gather facts on all hosts for following reference"
|
- debug: msg="gather facts on all Ceph hosts for following reference"
|
||||||
|
- name: check if sysvinit
|
||||||
|
stat:
|
||||||
|
path: /etc/rc?.d/S??ceph
|
||||||
|
follow: yes
|
||||||
|
register: is_sysvinit
|
||||||
|
|
||||||
|
- name: check if upstart
|
||||||
|
stat:
|
||||||
|
path: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/upstart
|
||||||
|
register: is_upstart
|
||||||
|
|
||||||
|
- name: check if systemd
|
||||||
|
command: grep -sq systemd /proc/1/comm
|
||||||
|
register: is_systemd
|
||||||
|
|
||||||
|
|
||||||
- hosts: mons
|
- hosts: mons
|
||||||
serial: 1
|
serial: 1
|
||||||
|
@ -48,46 +69,25 @@
|
||||||
- ceph-mon
|
- ceph-mon
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: check if sysvinit
|
- name: restart ceph mons with upstart
|
||||||
stat:
|
|
||||||
path: /etc/rc?.d/S??ceph
|
|
||||||
follow: yes
|
|
||||||
register: monsysvinit
|
|
||||||
|
|
||||||
- name: check if upstart
|
|
||||||
stat:
|
|
||||||
path: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/upstart
|
|
||||||
register: monupstart
|
|
||||||
|
|
||||||
- name: check if systemd
|
|
||||||
command: grep -sq systemd /proc/1/comm
|
|
||||||
register: is_systemd
|
|
||||||
|
|
||||||
- name: restart the monitor after compaction (upstart)
|
|
||||||
service:
|
service:
|
||||||
name: ceph-mon
|
name: ceph-mon
|
||||||
state: restarted
|
state: restarted
|
||||||
args: id={{ ansible_hostname }}
|
args: id={{ ansible_hostname }}
|
||||||
when: monupstart.stat.exists == True
|
when: is_upstart.stat.exists == True
|
||||||
|
|
||||||
- name: restart the monitor after compaction (sysvinit)
|
- name: restart ceph mons with sysvinit
|
||||||
service:
|
service:
|
||||||
name: ceph
|
name: ceph
|
||||||
state: restarted
|
state: restarted
|
||||||
when: monsysvinit.stat.exists == True
|
when: is_sysvinit.stat.exists == True
|
||||||
|
|
||||||
- name: restart monitor(s)
|
- name: restart ceph mons with systemd
|
||||||
service:
|
service:
|
||||||
name: ceph
|
name: ceph-mon@{{ ansible_hostname }}
|
||||||
state: restarted
|
state: restarted
|
||||||
args: mon
|
enabled: yes
|
||||||
when: not ansible_os_family == "RedHat"
|
when: is_systemd
|
||||||
|
|
||||||
- name: restart monitor(s)
|
|
||||||
service:
|
|
||||||
name: ceph
|
|
||||||
state: restarted
|
|
||||||
when: ansible_os_family == "RedHat"
|
|
||||||
|
|
||||||
- name: select a running monitor
|
- name: select a running monitor
|
||||||
set_fact: mon_host={{ item }}
|
set_fact: mon_host={{ item }}
|
||||||
|
@ -125,27 +125,30 @@
|
||||||
- ceph-osd
|
- ceph-osd
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: check if sysvinit
|
- name: get osd numbers
|
||||||
shell: stat /var/lib/ceph/osd/ceph-*/sysvinit
|
shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | cut -d '-' -f 2 ; fi"
|
||||||
register: osdsysvinit
|
register: osd_ids
|
||||||
failed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: check if upstart
|
- name: restart ceph osds (upstart)
|
||||||
shell: stat /var/lib/ceph/osd/ceph-*/upstart
|
|
||||||
register: osdupstart
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: gracefully stop the oss (upstart)
|
|
||||||
service:
|
service:
|
||||||
name: ceph-osd-all
|
name: ceph-osd-all
|
||||||
state: restarted
|
state: restarted
|
||||||
when: osdupstart.rc == 0
|
when: is_upstart.stat.exists == True
|
||||||
|
|
||||||
- name: gracefully stop the osds (sysvinit)
|
- name: restart ceph osds (sysvinit)
|
||||||
service:
|
service:
|
||||||
name: ceph
|
name: ceph
|
||||||
state: restarted
|
state: restarted
|
||||||
when: osdsysvinit.rc == 0
|
when: is_sysvinit.stat.exists == True
|
||||||
|
|
||||||
|
- name: restart ceph osds (systemd)
|
||||||
|
service:
|
||||||
|
name: ceph-osd@{{item}}
|
||||||
|
state: restarted
|
||||||
|
enabled: yes
|
||||||
|
with_items: "{{ osd_ids.stdout_lines }}"
|
||||||
|
when: is_systemd
|
||||||
|
|
||||||
- name: waiting for clean pgs...
|
- name: waiting for clean pgs...
|
||||||
shell: |
|
shell: |
|
||||||
|
@ -177,30 +180,26 @@
|
||||||
- ceph-mds
|
- ceph-mds
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: check if sysvinit
|
- name: restart ceph mdss with upstart
|
||||||
stat:
|
|
||||||
path: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/sysvinit
|
|
||||||
register: mdssysvinit
|
|
||||||
|
|
||||||
- name: check if upstart
|
|
||||||
stat:
|
|
||||||
path: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/upstart
|
|
||||||
register: mdsupstart
|
|
||||||
|
|
||||||
- name: restart the metadata server (upstart)
|
|
||||||
service:
|
service:
|
||||||
name: ceph-mds
|
name: ceph-mds
|
||||||
state: restarted
|
state: restarted
|
||||||
args: id={{ ansible_hostname }}
|
args: id={{ ansible_hostname }}
|
||||||
when: mdsupstart.stat.exists == True
|
when: is_upstart.stat.exists == True
|
||||||
|
|
||||||
- name: restart the metadata server (sysvinit)
|
- name: restart ceph mdss with sysvinit
|
||||||
service:
|
service:
|
||||||
name: ceph
|
name: ceph
|
||||||
state: restarted
|
state: restarted
|
||||||
args: mds
|
args: mds
|
||||||
when: mdssysvinit.stat.exists == True
|
when: is_sysvinit.stat.exists == True
|
||||||
|
|
||||||
|
- name: restart ceph mdss with systemd
|
||||||
|
service:
|
||||||
|
name: ceph-mds@{{ ansible_hostname }}
|
||||||
|
state: restarted
|
||||||
|
enabled: yes
|
||||||
|
when: is_systemd
|
||||||
|
|
||||||
- hosts: rgws
|
- hosts: rgws
|
||||||
serial: 1
|
serial: 1
|
||||||
|
@ -214,19 +213,21 @@
|
||||||
- ceph-rgw
|
- ceph-rgw
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: restart rados gateway server(s)
|
- name: restart ceph rgws with systemd
|
||||||
service:
|
service:
|
||||||
name: {{ item }}
|
name: ceph-radosgw@rgw.{{ ansible_hostname }}
|
||||||
state: restarted
|
state: restarted
|
||||||
with_items:
|
enabled: yes
|
||||||
- radosgw
|
when: is_systemd
|
||||||
when: radosgw_frontend == 'civetweb'
|
|
||||||
|
- name: restart ceph rgws with sysvinit
|
||||||
|
service:
|
||||||
|
name: radosgw
|
||||||
|
state: restarted
|
||||||
|
when: ansible_os_family != 'RedHat'
|
||||||
|
|
||||||
- name: restart rados gateway server(s)
|
- name: restart rados gateway server(s)
|
||||||
service:
|
service:
|
||||||
name: {{ item }}
|
name: ceph-radosgw
|
||||||
state: restarted
|
state: restarted
|
||||||
with_items:
|
when: ansible_os_family != 'RedHat'
|
||||||
- apache2
|
|
||||||
- radosgw
|
|
||||||
when: radosgw_frontend == 'apache'
|
|
||||||
|
|
Loading…
Reference in New Issue