2014-03-04 02:08:51 +08:00
|
|
|
---
|
|
|
|
# This playbook does a rolling update for all the Ceph services
|
2016-11-21 18:29:05 +08:00
|
|
|
#
|
|
|
|
# The value of 'serial:' adjusts the number of servers to be updated simultaneously.
|
|
|
|
# We recommend a value of 1, which means hosts of a group (e.g: monitor) will be
|
|
|
|
# upgraded one by one. It is really crucial for the update process to happen
|
|
|
|
# in a serialized fashion. DO NOT CHANGE THIS VALUE.
|
2014-03-04 02:08:51 +08:00
|
|
|
#
|
2014-07-08 21:39:42 +08:00
|
|
|
# The four roles that apply to the ceph hosts will be applied: ceph-common,
|
|
|
|
# ceph-mon, ceph-osd and ceph-mds. So any changes to configuration, package updates, etc,
|
2014-03-04 02:08:51 +08:00
|
|
|
# will be applied as part of the rolling update process.
|
|
|
|
#
|
|
|
|
|
|
|
|
# /!\ DO NOT FORGET TO CHANGE THE RELEASE VERSION FIRST! /!\
|
|
|
|
|
2016-06-01 00:13:47 +08:00
|
|
|
- name: confirm whether user really meant to upgrade the cluster
|
|
|
|
hosts: localhost
|
|
|
|
|
|
|
|
vars_prompt:
|
|
|
|
- name: ireallymeanit
|
|
|
|
prompt: Are you sure you want to upgrade the cluster?
|
|
|
|
default: 'no'
|
|
|
|
private: no
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: exit playbook, if user did not mean to upgrade cluster
|
|
|
|
fail:
|
|
|
|
msg: >
|
|
|
|
"Exiting rolling_update.yml playbook, cluster was NOT upgraded.
|
|
|
|
To upgrade the cluster, either say 'yes' on the prompt or
|
2016-11-15 03:04:43 +08:00
|
|
|
use `-e ireallymeanit=yes` on the command line when
|
2016-06-01 00:13:47 +08:00
|
|
|
invoking the playbook"
|
|
|
|
when: ireallymeanit != 'yes'
|
|
|
|
|
2016-11-16 16:35:09 +08:00
|
|
|
|
2016-10-26 05:56:58 +08:00
|
|
|
- name: gather facts and check the init system
|
2016-10-06 19:56:37 +08:00
|
|
|
|
2016-10-26 05:56:58 +08:00
|
|
|
hosts:
|
2017-03-08 03:16:12 +08:00
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
2017-04-11 20:20:11 +08:00
|
|
|
- "{{ mgr_group_name|default('mgrs') }}"
|
2017-07-29 04:27:02 +08:00
|
|
|
- "{{ client_group_name|default('clients') }}"
|
2016-06-15 23:08:15 +08:00
|
|
|
|
|
|
|
become: True
|
2015-04-15 03:50:39 +08:00
|
|
|
tasks:
|
2016-06-15 23:08:15 +08:00
|
|
|
- debug: msg="gather facts on all Ceph hosts for following reference"
|
2016-11-06 12:15:26 +08:00
|
|
|
|
|
|
|
- set_fact: rolling_update=true
|
|
|
|
|
2016-10-06 19:56:37 +08:00
|
|
|
- name: upgrade ceph mon cluster
|
|
|
|
|
2016-01-29 23:54:59 +08:00
|
|
|
vars:
|
2016-10-03 17:24:59 +08:00
|
|
|
health_mon_check_retries: 5
|
2017-06-13 05:07:52 +08:00
|
|
|
health_mon_check_delay: 15
|
2016-11-05 00:31:02 +08:00
|
|
|
upgrade_ceph_packages: True
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-10-06 19:56:37 +08:00
|
|
|
hosts:
|
2017-03-08 03:16:12 +08:00
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
2016-10-06 19:56:37 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: True
|
|
|
|
|
2016-11-15 04:40:31 +08:00
|
|
|
pre_tasks:
|
2016-11-15 03:04:43 +08:00
|
|
|
- name: set mon_host_count
|
2017-03-24 14:40:15 +08:00
|
|
|
set_fact: mon_host_count={{ groups[mon_group_name] | length }}
|
2016-11-15 03:04:43 +08:00
|
|
|
|
2016-11-16 16:35:09 +08:00
|
|
|
- debug: msg="WARNING - upgrading a ceph cluster with only one monitor node ({{ inventory_hostname }})"
|
2016-11-15 03:04:43 +08:00
|
|
|
when: mon_host_count | int == 1
|
2016-11-15 04:40:31 +08:00
|
|
|
|
|
|
|
- name: stop ceph mons with upstart
|
|
|
|
service:
|
|
|
|
name: ceph-mon
|
|
|
|
state: stopped
|
|
|
|
args: id={{ ansible_hostname }}
|
2017-02-18 04:31:25 +08:00
|
|
|
when: ansible_service_mgr == 'upstart'
|
2016-11-15 04:40:31 +08:00
|
|
|
|
|
|
|
- name: stop ceph mons with sysvinit
|
|
|
|
service:
|
|
|
|
name: ceph
|
|
|
|
state: stopped
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'sysvinit'
|
2016-11-15 04:40:31 +08:00
|
|
|
|
|
|
|
- name: stop ceph mons with systemd
|
|
|
|
service:
|
|
|
|
name: ceph-mon@{{ ansible_hostname }}
|
|
|
|
state: stopped
|
|
|
|
enabled: yes
|
2016-11-16 16:35:09 +08:00
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- not containerized_deployment
|
2016-11-15 04:40:31 +08:00
|
|
|
|
2014-03-04 02:08:51 +08:00
|
|
|
roles:
|
2017-07-29 04:27:02 +08:00
|
|
|
- ceph-defaults
|
2017-07-29 04:48:13 +08:00
|
|
|
- { role: ceph-common, when: not containerized_deployment }
|
|
|
|
- { role: ceph-docker-common, when: containerized_deployment }
|
2015-03-27 01:51:11 +08:00
|
|
|
- ceph-mon
|
|
|
|
|
2014-03-04 02:08:51 +08:00
|
|
|
post_tasks:
|
2016-11-15 04:40:31 +08:00
|
|
|
- name: start ceph mons with upstart
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
|
|
|
name: ceph-mon
|
2016-11-15 04:40:31 +08:00
|
|
|
state: started
|
2016-06-01 00:13:47 +08:00
|
|
|
args: id={{ ansible_hostname }}
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'upstart'
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-15 04:40:31 +08:00
|
|
|
- name: start ceph mons with sysvinit
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
|
|
|
name: ceph
|
2016-11-15 04:40:31 +08:00
|
|
|
state: started
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'sysvinit'
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-15 04:40:31 +08:00
|
|
|
- name: start ceph mons with systemd
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
2016-06-15 23:08:15 +08:00
|
|
|
name: ceph-mon@{{ ansible_hostname }}
|
2016-11-15 04:40:31 +08:00
|
|
|
state: started
|
2016-06-15 23:08:15 +08:00
|
|
|
enabled: yes
|
2016-11-16 16:35:09 +08:00
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- not containerized_deployment
|
2016-11-16 16:35:09 +08:00
|
|
|
|
|
|
|
- name: restart containerized ceph mons with systemd
|
|
|
|
service:
|
|
|
|
name: ceph-mon@{{ ansible_hostname }}
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- containerized_deployment
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: set mon_host_count
|
2017-03-24 14:40:15 +08:00
|
|
|
set_fact: mon_host_count={{ groups[mon_group_name] | length }}
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: select a running monitor if multiple monitors
|
2015-04-17 10:04:52 +08:00
|
|
|
set_fact: mon_host={{ item }}
|
2017-03-24 14:40:15 +08:00
|
|
|
with_items: "{{ groups[mon_group_name] }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
when:
|
|
|
|
- mon_host_count | int > 1
|
|
|
|
- item != inventory_hostname
|
|
|
|
|
|
|
|
- name: select first monitor if only one monitor
|
|
|
|
set_fact: mon_host={{ item }}
|
2017-03-24 14:40:15 +08:00
|
|
|
with_items: "{{ groups[mon_group_name][0] }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
when:
|
|
|
|
- mon_host_count | int == 1
|
2015-04-17 10:04:52 +08:00
|
|
|
|
2016-06-01 00:13:47 +08:00
|
|
|
- name: waiting for the monitor to join the quorum...
|
|
|
|
shell: |
|
2017-07-11 21:36:01 +08:00
|
|
|
ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["quorum_names"])'
|
2015-03-27 01:51:11 +08:00
|
|
|
register: result
|
2017-07-11 21:36:01 +08:00
|
|
|
until: "{{ ansible_hostname in result.stdout }}"
|
2016-10-03 17:24:59 +08:00
|
|
|
retries: "{{ health_mon_check_retries }}"
|
|
|
|
delay: "{{ health_mon_check_delay }}"
|
2015-04-17 10:04:52 +08:00
|
|
|
delegate_to: "{{ mon_host }}"
|
2017-04-13 01:57:33 +08:00
|
|
|
when: not containerized_deployment
|
2016-11-06 12:15:26 +08:00
|
|
|
|
|
|
|
- name: waiting for the containerized monitor to join the quorum...
|
|
|
|
shell: |
|
2017-07-11 21:36:01 +08:00
|
|
|
docker exec ceph-mon-{{ hostvars[mon_host]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["quorum_names"])'
|
2015-03-27 01:51:11 +08:00
|
|
|
register: result
|
2017-07-11 21:36:01 +08:00
|
|
|
until: "{{ ansible_hostname in result.stdout }}"
|
2016-10-03 17:24:59 +08:00
|
|
|
retries: "{{ health_mon_check_retries }}"
|
|
|
|
delay: "{{ health_mon_check_delay }}"
|
2015-04-17 10:04:52 +08:00
|
|
|
delegate_to: "{{ mon_host }}"
|
2017-04-13 01:57:33 +08:00
|
|
|
when: containerized_deployment
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-06-01 00:13:47 +08:00
|
|
|
- name: set osd flags
|
2016-09-06 22:29:00 +08:00
|
|
|
command: ceph osd set {{ item }} --cluster {{ cluster }}
|
2015-04-28 01:08:05 +08:00
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- noscrub
|
|
|
|
- nodeep-scrub
|
2017-03-24 14:40:15 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-04-13 01:57:33 +08:00
|
|
|
when: not containerized_deployment
|
2016-11-16 16:35:09 +08:00
|
|
|
|
|
|
|
- name: set containerized osd flags
|
|
|
|
command: |
|
2017-05-22 15:38:08 +08:00
|
|
|
docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph osd set {{ item }} --cluster {{ cluster }}
|
2016-11-16 16:35:09 +08:00
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- noscrub
|
|
|
|
- nodeep-scrub
|
2017-03-24 14:40:15 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-04-13 01:57:33 +08:00
|
|
|
when: containerized_deployment
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-05-12 21:59:52 +08:00
|
|
|
|
|
|
|
- name: upgrade ceph osds cluster
|
|
|
|
|
|
|
|
vars:
|
|
|
|
health_osd_check_retries: 40
|
|
|
|
health_osd_check_delay: 30
|
|
|
|
upgrade_ceph_packages: True
|
|
|
|
|
|
|
|
hosts:
|
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: True
|
|
|
|
|
|
|
|
pre_tasks:
|
2016-11-15 04:25:46 +08:00
|
|
|
- name: get osd numbers
|
2017-03-30 17:51:38 +08:00
|
|
|
shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi"
|
2016-11-15 04:25:46 +08:00
|
|
|
register: osd_ids
|
|
|
|
changed_when: false
|
2017-04-13 01:57:33 +08:00
|
|
|
when: not containerized_deployment
|
2016-11-15 04:25:46 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: stop ceph osds with upstart
|
2016-11-15 04:25:46 +08:00
|
|
|
service:
|
|
|
|
name: ceph-osd-all
|
|
|
|
state: stopped
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'upstart'
|
2016-11-15 04:25:46 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: stop ceph osds with sysvinit
|
2016-11-15 04:25:46 +08:00
|
|
|
service:
|
|
|
|
name: ceph
|
|
|
|
state: stopped
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'sysvinit'
|
2016-11-15 04:25:46 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: stop ceph osds with systemd
|
2016-11-15 04:25:46 +08:00
|
|
|
service:
|
|
|
|
name: ceph-osd@{{item}}
|
|
|
|
state: stopped
|
|
|
|
enabled: yes
|
|
|
|
with_items: "{{ osd_ids.stdout_lines }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- not containerized_deployment
|
2016-11-15 04:25:46 +08:00
|
|
|
|
2014-03-04 02:08:51 +08:00
|
|
|
roles:
|
2017-07-29 04:27:02 +08:00
|
|
|
- ceph-defaults
|
2017-07-29 04:48:13 +08:00
|
|
|
- { role: ceph-common, when: not containerized_deployment }
|
|
|
|
- { role: ceph-docker-common, when: containerized_deployment }
|
2015-03-27 01:51:11 +08:00
|
|
|
- ceph-osd
|
|
|
|
|
2014-03-04 02:08:51 +08:00
|
|
|
post_tasks:
|
2016-06-15 23:08:15 +08:00
|
|
|
- name: get osd numbers
|
2017-03-30 17:51:38 +08:00
|
|
|
shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi"
|
2016-06-15 23:08:15 +08:00
|
|
|
register: osd_ids
|
|
|
|
changed_when: false
|
2017-04-13 01:57:33 +08:00
|
|
|
when: not containerized_deployment
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: start ceph osds with upstart
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
|
|
|
name: ceph-osd-all
|
2016-11-15 04:25:46 +08:00
|
|
|
state: started
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'upstart'
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: start ceph osds with sysvinit
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
|
|
|
name: ceph
|
2016-11-15 04:25:46 +08:00
|
|
|
state: started
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'sysvinit'
|
2016-06-15 23:08:15 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: start ceph osds with systemd
|
2016-06-15 23:08:15 +08:00
|
|
|
service:
|
|
|
|
name: ceph-osd@{{item}}
|
2016-11-15 04:25:46 +08:00
|
|
|
state: started
|
2016-06-15 23:08:15 +08:00
|
|
|
enabled: yes
|
|
|
|
with_items: "{{ osd_ids.stdout_lines }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- not containerized_deployment
|
2016-11-06 12:15:26 +08:00
|
|
|
|
|
|
|
- name: restart containerized ceph osds with systemd
|
|
|
|
service:
|
|
|
|
name: ceph-osd@{{ item | basename }}
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
2017-07-25 23:54:26 +08:00
|
|
|
with_items: "{{ devices }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- containerized_deployment
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-08-23 18:31:15 +08:00
|
|
|
- name: get pg num
|
|
|
|
shell: |
|
|
|
|
ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])'
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
register: num_pgs
|
|
|
|
when:
|
|
|
|
- not containerized_deployment
|
|
|
|
|
2016-06-01 00:13:47 +08:00
|
|
|
- name: waiting for clean pgs...
|
|
|
|
shell: |
|
2017-06-22 23:42:03 +08:00
|
|
|
test "[""$(ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')""]" = "$(ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if i["state_name"] == "active+clean"]')"
|
2015-03-27 01:51:11 +08:00
|
|
|
register: result
|
|
|
|
until: result.rc == 0
|
2016-10-03 17:24:59 +08:00
|
|
|
retries: "{{ health_osd_check_retries }}"
|
|
|
|
delay: "{{ health_osd_check_delay }}"
|
2017-03-24 14:40:15 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-08-23 18:31:15 +08:00
|
|
|
when:
|
|
|
|
- not containerized_deployment
|
|
|
|
- num_pgs.stdout != "0"
|
|
|
|
|
|
|
|
- name: container - get pg num
|
|
|
|
shell: |
|
|
|
|
docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])'
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
register: container_num_pgs
|
|
|
|
when:
|
|
|
|
- containerized_deployment
|
2016-11-06 12:15:26 +08:00
|
|
|
|
|
|
|
- name: container - waiting for clean pgs...
|
|
|
|
shell: |
|
2017-06-22 23:42:03 +08:00
|
|
|
test "[""$(docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')""]" = "$(docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if i["state_name"] == "active+clean"]')"
|
2016-11-06 12:15:26 +08:00
|
|
|
register: result
|
|
|
|
until: result.rc == 0
|
|
|
|
retries: "{{ health_osd_check_retries }}"
|
|
|
|
delay: "{{ health_osd_check_delay }}"
|
2017-03-24 14:40:15 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-08-23 18:31:15 +08:00
|
|
|
when:
|
|
|
|
- containerized_deployment
|
|
|
|
- container_num_pgs.stdout != "0"
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-05-12 21:59:52 +08:00
|
|
|
|
|
|
|
- name: unset osd flags
|
|
|
|
|
|
|
|
hosts:
|
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
|
|
|
|
|
|
|
become: True
|
|
|
|
|
|
|
|
roles:
|
|
|
|
- ceph-defaults
|
|
|
|
|
|
|
|
tasks:
|
2016-06-01 00:13:47 +08:00
|
|
|
- name: unset osd flags
|
2016-09-06 22:29:00 +08:00
|
|
|
command: ceph osd unset {{ item }} --cluster {{ cluster }}
|
2015-04-28 01:08:05 +08:00
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- noscrub
|
|
|
|
- nodeep-scrub
|
2017-03-24 14:40:15 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-04-13 01:57:33 +08:00
|
|
|
when: not containerized_deployment
|
2016-11-06 12:15:26 +08:00
|
|
|
|
|
|
|
- name: unset containerized osd flags
|
|
|
|
command: |
|
2017-05-22 15:38:08 +08:00
|
|
|
docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph osd unset {{ item }} --cluster {{ cluster }}
|
2016-11-06 12:15:26 +08:00
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- noscrub
|
|
|
|
- nodeep-scrub
|
2017-03-24 14:40:15 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-04-13 01:57:33 +08:00
|
|
|
when: containerized_deployment
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2014-03-04 02:08:51 +08:00
|
|
|
|
2016-10-06 19:56:37 +08:00
|
|
|
- name: upgrade ceph mdss cluster
|
|
|
|
|
2016-01-29 23:54:59 +08:00
|
|
|
vars:
|
2016-11-05 00:31:02 +08:00
|
|
|
upgrade_ceph_packages: True
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-10-06 19:56:37 +08:00
|
|
|
hosts:
|
2017-03-08 03:16:12 +08:00
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
2016-10-06 19:56:37 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: True
|
|
|
|
|
2016-11-15 04:42:52 +08:00
|
|
|
pre_tasks:
|
|
|
|
- name: stop ceph mdss with upstart
|
|
|
|
service:
|
|
|
|
name: ceph-mds
|
|
|
|
state: stopped
|
|
|
|
args: id={{ ansible_hostname }}
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'upstart'
|
2016-11-15 04:42:52 +08:00
|
|
|
|
|
|
|
- name: stop ceph mdss with sysvinit
|
|
|
|
service:
|
|
|
|
name: ceph
|
|
|
|
state: stopped
|
|
|
|
args: mds
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'sysvinit'
|
2016-11-15 04:42:52 +08:00
|
|
|
|
|
|
|
- name: stop ceph mdss with systemd
|
|
|
|
service:
|
|
|
|
name: ceph-mds@{{ ansible_hostname }}
|
|
|
|
state: stopped
|
|
|
|
enabled: yes
|
2016-11-16 16:35:09 +08:00
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- not containerized_deployment
|
2016-11-15 04:42:52 +08:00
|
|
|
|
2014-03-04 02:08:51 +08:00
|
|
|
roles:
|
2017-07-29 04:27:02 +08:00
|
|
|
- ceph-defaults
|
2017-07-29 04:48:13 +08:00
|
|
|
- { role: ceph-common, when: not containerized_deployment }
|
|
|
|
- { role: ceph-docker-common, when: containerized_deployment }
|
2015-03-27 01:51:11 +08:00
|
|
|
- ceph-mds
|
|
|
|
|
2014-03-04 02:08:51 +08:00
|
|
|
post_tasks:
|
2016-11-15 04:42:52 +08:00
|
|
|
- name: start ceph mdss with upstart
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
|
|
|
name: ceph-mds
|
2016-11-15 04:42:52 +08:00
|
|
|
state: started
|
2016-06-01 00:13:47 +08:00
|
|
|
args: id={{ ansible_hostname }}
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'upstart'
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-15 04:42:52 +08:00
|
|
|
- name: start ceph mdss with sysvinit
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
|
|
|
name: ceph
|
2016-11-15 04:42:52 +08:00
|
|
|
state: started
|
2016-06-01 00:13:47 +08:00
|
|
|
args: mds
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'sysvinit'
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-15 04:42:52 +08:00
|
|
|
- name: start ceph mdss with systemd
|
2016-06-15 23:08:15 +08:00
|
|
|
service:
|
|
|
|
name: ceph-mds@{{ ansible_hostname }}
|
2016-11-15 04:42:52 +08:00
|
|
|
state: started
|
2016-06-15 23:08:15 +08:00
|
|
|
enabled: yes
|
2016-11-16 16:35:09 +08:00
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- not containerized_deployment
|
2016-11-16 16:35:09 +08:00
|
|
|
|
2017-01-20 17:14:35 +08:00
|
|
|
- name: restart ceph mdss
|
2016-11-16 16:35:09 +08:00
|
|
|
service:
|
|
|
|
name: ceph-mds@{{ ansible_hostname }}
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- containerized_deployment
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-10-06 19:56:37 +08:00
|
|
|
|
|
|
|
- name: upgrade ceph rgws cluster
|
|
|
|
|
2016-01-29 23:54:59 +08:00
|
|
|
vars:
|
2016-11-05 00:31:02 +08:00
|
|
|
upgrade_ceph_packages: True
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-10-06 19:56:37 +08:00
|
|
|
hosts:
|
2017-03-08 03:16:12 +08:00
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
2016-10-06 19:56:37 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: True
|
|
|
|
|
2016-11-15 04:44:55 +08:00
|
|
|
pre_tasks:
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: stop ceph rgws with upstart
|
2016-11-15 04:44:55 +08:00
|
|
|
service:
|
2016-11-06 12:15:26 +08:00
|
|
|
name: ceph-radosgw
|
2016-11-15 04:44:55 +08:00
|
|
|
state: stopped
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'upstart'
|
2016-11-15 04:44:55 +08:00
|
|
|
|
|
|
|
- name: stop ceph rgws with sysvinit
|
|
|
|
service:
|
|
|
|
name: radosgw
|
|
|
|
state: stopped
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'sysvinit'
|
2016-11-15 04:44:55 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: stop ceph rgws with systemd
|
2016-11-15 04:44:55 +08:00
|
|
|
service:
|
2016-11-06 12:15:26 +08:00
|
|
|
name: ceph-radosgw@rgw.{{ ansible_hostname }}
|
2016-11-15 04:44:55 +08:00
|
|
|
state: stopped
|
2016-11-06 12:15:26 +08:00
|
|
|
enabled: yes
|
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- not containerized_deployment
|
2016-11-15 04:44:55 +08:00
|
|
|
|
2015-03-27 01:51:11 +08:00
|
|
|
roles:
|
2017-07-29 04:27:02 +08:00
|
|
|
- ceph-defaults
|
2017-07-29 04:48:13 +08:00
|
|
|
- { role: ceph-common, when: not containerized_deployment }
|
|
|
|
- { role: ceph-docker-common, when: containerized_deployment }
|
2015-07-25 00:14:59 +08:00
|
|
|
- ceph-rgw
|
2015-03-27 01:51:11 +08:00
|
|
|
|
|
|
|
post_tasks:
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: start ceph rgws with upstart
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
2016-11-06 12:15:26 +08:00
|
|
|
name: ceph-radosgw
|
2016-11-15 04:44:55 +08:00
|
|
|
state: started
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'upstart'
|
2016-06-15 23:08:15 +08:00
|
|
|
|
2016-11-15 04:44:55 +08:00
|
|
|
- name: start ceph rgws with sysvinit
|
2016-06-15 23:08:15 +08:00
|
|
|
service:
|
|
|
|
name: radosgw
|
2016-11-15 04:44:55 +08:00
|
|
|
state: started
|
2017-02-08 05:37:29 +08:00
|
|
|
when: ansible_service_mgr == 'sysvinit'
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
- name: start ceph rgws with systemd
|
2016-06-01 00:13:47 +08:00
|
|
|
service:
|
2016-11-06 12:15:26 +08:00
|
|
|
name: ceph-radosgw@rgw.{{ ansible_hostname }}
|
2016-11-15 04:44:55 +08:00
|
|
|
state: started
|
2016-11-06 12:15:26 +08:00
|
|
|
enabled: yes
|
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- not containerized_deployment
|
2016-11-06 12:15:26 +08:00
|
|
|
|
|
|
|
- name: restart containerized ceph rgws with systemd
|
|
|
|
service:
|
2017-07-29 07:00:06 +08:00
|
|
|
name: ceph-radosgw@{{ ansible_hostname }}
|
2016-11-06 12:15:26 +08:00
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
|
|
|
when:
|
2017-02-08 05:37:29 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2017-04-13 01:57:33 +08:00
|
|
|
- containerized_deployment
|
2017-07-29 04:27:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
- name: upgrade ceph client node
|
|
|
|
|
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
|
|
|
|
|
|
|
hosts:
|
|
|
|
- "{{ client_group_name|default('clients') }}"
|
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: True
|
|
|
|
|
|
|
|
roles:
|
|
|
|
- ceph-defaults
|
2017-07-29 04:48:13 +08:00
|
|
|
- ceph-common
|
2017-07-29 04:27:02 +08:00
|
|
|
- ceph-client
|