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
|
|
|
#
|
|
|
|
#
|
2017-09-14 05:46:29 +08:00
|
|
|
# If you run a Ceph community version, you have to change the variable: ceph_stable_release to the new release
|
|
|
|
#
|
|
|
|
# If you run Red Hat Ceph Storage and are doing a **major** update (e.g: from 2 to 3), you have two options:
|
|
|
|
# - if you use a CDN, you have to change the ceph_rhcs_version to a newer one
|
|
|
|
# - if you use an ISO, you have to change the ceph_rhcs_iso_path to the directory containing the new Ceph version
|
|
|
|
#
|
2014-03-04 02:08:51 +08:00
|
|
|
|
2016-06-01 00:13:47 +08:00
|
|
|
- name: confirm whether user really meant to upgrade the cluster
|
|
|
|
hosts: localhost
|
2017-12-16 00:39:32 +08:00
|
|
|
become: false
|
2017-10-19 00:03:30 +08:00
|
|
|
vars:
|
|
|
|
- mgr_group_name: mgrs
|
2016-06-01 00:13:47 +08:00
|
|
|
|
|
|
|
vars_prompt:
|
|
|
|
- name: ireallymeanit
|
|
|
|
prompt: Are you sure you want to upgrade the cluster?
|
|
|
|
default: 'no'
|
|
|
|
private: no
|
|
|
|
|
|
|
|
tasks:
|
2017-10-19 00:03:30 +08:00
|
|
|
- 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
|
|
|
|
use `-e ireallymeanit=yes` on the command line when
|
|
|
|
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-10-16 20:15:43 +08:00
|
|
|
- "{{ rbd_mirror_group_name|default('rbdmirrors') }}"
|
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2017-07-29 04:27:02 +08:00
|
|
|
- "{{ client_group_name|default('clients') }}"
|
2019-03-21 20:28:33 +08:00
|
|
|
- "{{ iscsi_gw_group_name|default('iscsigws') }}"
|
2016-06-15 23:08:15 +08:00
|
|
|
|
|
|
|
become: True
|
2017-10-19 00:03:30 +08:00
|
|
|
gather_facts: False
|
|
|
|
vars:
|
|
|
|
delegate_facts_host: 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
|
|
|
|
2017-10-19 00:03:30 +08:00
|
|
|
- name: gather facts
|
|
|
|
setup:
|
2019-04-01 23:46:15 +08:00
|
|
|
when: not delegate_facts_host | bool
|
2017-10-19 00:03:30 +08:00
|
|
|
|
|
|
|
- name: gather and delegate facts
|
|
|
|
setup:
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
delegate_facts: True
|
|
|
|
with_items: "{{ groups['all'] }}"
|
2018-06-05 22:30:12 +08:00
|
|
|
run_once: true
|
2019-04-01 23:46:15 +08:00
|
|
|
when: delegate_facts_host | bool
|
2017-10-19 00:03:30 +08:00
|
|
|
|
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
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}"
|
2016-10-06 19:56:37 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2019-03-15 22:18:48 +08:00
|
|
|
- name: remove ceph aliases
|
|
|
|
file:
|
|
|
|
path: /etc/profile.d/ceph-aliases.sh
|
|
|
|
state: absent
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2019-03-15 22:18:48 +08:00
|
|
|
|
2016-11-15 03:04:43 +08:00
|
|
|
- name: set mon_host_count
|
2019-03-20 16:46:21 +08:00
|
|
|
set_fact:
|
|
|
|
mon_host_count: "{{ groups[mon_group_name] | length }}"
|
2016-11-15 03:04:43 +08:00
|
|
|
|
2018-12-03 22:25:42 +08:00
|
|
|
- name: fail when less than three monitors
|
2017-10-16 20:15:43 +08:00
|
|
|
fail:
|
2018-12-03 22:25:42 +08:00
|
|
|
msg: "Upgrade of cluster with less than three monitors is not supported."
|
2019-04-01 23:46:15 +08:00
|
|
|
when: mon_host_count | int < 3
|
2016-11-15 04:40:31 +08:00
|
|
|
|
2019-03-20 16:46:21 +08:00
|
|
|
- name: select a running monitor
|
|
|
|
set_fact:
|
|
|
|
mon_host: "{{ groups[mon_group_name] | difference([inventory_hostname]) | last }}"
|
|
|
|
|
2019-03-25 16:48:48 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
- name: ensure /var/lib/ceph/bootstrap-rbd-mirror is present
|
|
|
|
file:
|
|
|
|
path: /var/lib/ceph/bootstrap-rbd-mirror
|
|
|
|
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
mode: '755'
|
|
|
|
state: directory
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
with_items: "{{ groups[mon_group_name] }}"
|
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- cephx | bool
|
2019-03-25 16:48:48 +08:00
|
|
|
- inventory_hostname == groups[mon_group_name][0]
|
|
|
|
|
|
|
|
- name: create potentially missing keys (rbd and rbd-mirror)
|
|
|
|
ceph_key:
|
|
|
|
name: "client.{{ item.0 }}"
|
|
|
|
state: present
|
|
|
|
dest: "/var/lib/ceph/{{ item.0 }}/"
|
|
|
|
caps:
|
|
|
|
mon: "allow profile {{ item.0 }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
delegate_to: "{{ item.1 }}"
|
|
|
|
with_nested:
|
|
|
|
- ['bootstrap-rbd', 'bootstrap-rbd-mirror']
|
|
|
|
- "{{ groups[mon_group_name] }}" # so the key goes on all the nodes
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- cephx | bool
|
2019-03-25 16:48:48 +08:00
|
|
|
- inventory_hostname == groups[mon_group_name][0]
|
|
|
|
|
2019-03-20 18:35:36 +08:00
|
|
|
# NOTE: we mask the service so the RPM can't restart it
|
|
|
|
# after the package gets upgraded
|
2018-08-09 17:32:53 +08:00
|
|
|
- name: stop ceph mon - shortname
|
2017-10-16 20:15:43 +08:00
|
|
|
systemd:
|
2016-11-15 04:40:31 +08:00
|
|
|
name: ceph-mon@{{ ansible_hostname }}
|
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2018-08-09 17:32:53 +08:00
|
|
|
ignore_errors: True
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-08-09 17:32:53 +08:00
|
|
|
|
2019-03-20 18:35:36 +08:00
|
|
|
# NOTE: we mask the service so the RPM can't restart it
|
|
|
|
# after the package gets upgraded
|
2018-08-09 17:32:53 +08:00
|
|
|
- name: stop ceph mon - fqdn
|
|
|
|
systemd:
|
|
|
|
name: ceph-mon@{{ ansible_fqdn }}
|
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2018-08-09 17:32:53 +08:00
|
|
|
ignore_errors: True
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-15 04:40:31 +08:00
|
|
|
|
2019-03-20 18:35:36 +08:00
|
|
|
# only mask the service for mgr because it must be upgraded
|
|
|
|
# after ALL monitors, even when collocated
|
|
|
|
- name: mask the mgr service
|
2018-10-16 21:40:35 +08:00
|
|
|
systemd:
|
|
|
|
name: ceph-mgr@{{ ansible_hostname }}
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: yes
|
2019-04-01 23:46:15 +08:00
|
|
|
when: inventory_hostname in groups[mgr_group_name] | default([])
|
|
|
|
or groups[mgr_group_name] | default([]) | length == 0
|
2018-10-16 21:40:35 +08:00
|
|
|
|
2019-03-20 16:46:21 +08:00
|
|
|
- name: set osd flags
|
|
|
|
command: ceph --cluster {{ cluster }} osd set {{ item }}
|
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- norebalance
|
|
|
|
delegate_to: "{{ mon_host }}"
|
|
|
|
when:
|
|
|
|
- inventory_hostname == groups[mon_group_name][0]
|
2019-05-22 16:02:42 +08:00
|
|
|
- not containerized_deployment | bool
|
2019-03-20 16:46:21 +08:00
|
|
|
|
|
|
|
- name: set containerized osd flags
|
|
|
|
command: >
|
|
|
|
{{ container_binary }} exec ceph-mon-{{ hostvars[mon_host]['ansible_hostname'] }} ceph --cluster {{ cluster }} osd set {{ item }}
|
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- norebalance
|
|
|
|
delegate_to: "{{ mon_host }}"
|
|
|
|
when:
|
|
|
|
- inventory_hostname == groups[mon_group_name][0]
|
2019-05-22 16:02:42 +08:00
|
|
|
- containerized_deployment | bool
|
2019-03-20 16:46:21 +08:00
|
|
|
|
update: set osd flags before upgrading any mon
Typical error:
```
failed: [mon0 -> mon2] (item=noout) => changed=true
cmd:
- ceph
- --cluster
- ceph
- osd
- set
- noout
delta: '0:00:00.293756'
end: '2019-04-17 06:31:57.552386'
item: noout
msg: non-zero return code
rc: 1
start: '2019-04-17 06:31:57.258630'
stderr: |-
Traceback (most recent call last):
File "/bin/ceph", line 1222, in <module>
retval = main()
File "/bin/ceph", line 1146, in main
sigdict = parse_json_funcsigs(outbuf.decode('utf-8'), 'cli')
File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 788, in parse_json_funcsigs
cmd['sig'] = parse_funcsig(cmd['sig'])
File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 728, in parse_funcsig
raise JsonFormat(s)
ceph_argparse.JsonFormat: unknown type CephBool
stderr_lines:
- 'Traceback (most recent call last):'
- ' File "/bin/ceph", line 1222, in <module>'
- ' retval = main()'
- ' File "/bin/ceph", line 1146, in main'
- ' sigdict = parse_json_funcsigs(outbuf.decode(''utf-8''), ''cli'')'
- ' File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 788, in parse_json_funcsigs'
- ' cmd[''sig''] = parse_funcsig(cmd[''sig''])'
- ' File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 728, in parse_funcsig'
- ' raise JsonFormat(s)'
- 'ceph_argparse.JsonFormat: unknown type CephBool'
stdout: ''
stdout_lines: <omitted>
```
Having mixed versions of monitors seems to cause this error.
Moving these tasks before any monitor gets upgraded seems to be enough
to get around this issue.
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 543d1e2e41c00bccf611c7e240ba0d8f4eda5d95)
2019-04-17 14:47:25 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
update: set osd flags before upgrading any mon
Typical error:
```
failed: [mon0 -> mon2] (item=noout) => changed=true
cmd:
- ceph
- --cluster
- ceph
- osd
- set
- noout
delta: '0:00:00.293756'
end: '2019-04-17 06:31:57.552386'
item: noout
msg: non-zero return code
rc: 1
start: '2019-04-17 06:31:57.258630'
stderr: |-
Traceback (most recent call last):
File "/bin/ceph", line 1222, in <module>
retval = main()
File "/bin/ceph", line 1146, in main
sigdict = parse_json_funcsigs(outbuf.decode('utf-8'), 'cli')
File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 788, in parse_json_funcsigs
cmd['sig'] = parse_funcsig(cmd['sig'])
File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 728, in parse_funcsig
raise JsonFormat(s)
ceph_argparse.JsonFormat: unknown type CephBool
stderr_lines:
- 'Traceback (most recent call last):'
- ' File "/bin/ceph", line 1222, in <module>'
- ' retval = main()'
- ' File "/bin/ceph", line 1146, in main'
- ' sigdict = parse_json_funcsigs(outbuf.decode(''utf-8''), ''cli'')'
- ' File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 788, in parse_json_funcsigs'
- ' cmd[''sig''] = parse_funcsig(cmd[''sig''])'
- ' File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 728, in parse_funcsig'
- ' raise JsonFormat(s)'
- 'ceph_argparse.JsonFormat: unknown type CephBool'
stdout: ''
stdout_lines: <omitted>
```
Having mixed versions of monitors seems to cause this error.
Moving these tasks before any monitor gets upgraded seems to be enough
to get around this issue.
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 543d1e2e41c00bccf611c7e240ba0d8f4eda5d95)
2019-04-17 14:47:25 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
update: set osd flags before upgrading any mon
Typical error:
```
failed: [mon0 -> mon2] (item=noout) => changed=true
cmd:
- ceph
- --cluster
- ceph
- osd
- set
- noout
delta: '0:00:00.293756'
end: '2019-04-17 06:31:57.552386'
item: noout
msg: non-zero return code
rc: 1
start: '2019-04-17 06:31:57.258630'
stderr: |-
Traceback (most recent call last):
File "/bin/ceph", line 1222, in <module>
retval = main()
File "/bin/ceph", line 1146, in main
sigdict = parse_json_funcsigs(outbuf.decode('utf-8'), 'cli')
File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 788, in parse_json_funcsigs
cmd['sig'] = parse_funcsig(cmd['sig'])
File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 728, in parse_funcsig
raise JsonFormat(s)
ceph_argparse.JsonFormat: unknown type CephBool
stderr_lines:
- 'Traceback (most recent call last):'
- ' File "/bin/ceph", line 1222, in <module>'
- ' retval = main()'
- ' File "/bin/ceph", line 1146, in main'
- ' sigdict = parse_json_funcsigs(outbuf.decode(''utf-8''), ''cli'')'
- ' File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 788, in parse_json_funcsigs'
- ' cmd[''sig''] = parse_funcsig(cmd[''sig''])'
- ' File "/usr/lib/python2.7/site-packages/ceph_argparse.py", line 728, in parse_funcsig'
- ' raise JsonFormat(s)'
- 'ceph_argparse.JsonFormat: unknown type CephBool'
stdout: ''
stdout_lines: <omitted>
```
Having mixed versions of monitors seems to cause this error.
Moving these tasks before any monitor gets upgraded seems to be enough
to get around this issue.
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 543d1e2e41c00bccf611c7e240ba0d8f4eda5d95)
2019-04-17 14:47:25 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mon
|
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: start ceph mon
|
|
|
|
systemd:
|
2018-08-09 17:32:53 +08:00
|
|
|
name: ceph-mon@{{ monitor_name }}
|
2016-11-15 04:40:31 +08:00
|
|
|
state: started
|
2016-06-15 23:08:15 +08:00
|
|
|
enabled: yes
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-16 16:35:09 +08:00
|
|
|
|
2018-10-16 21:40:35 +08:00
|
|
|
- name: start ceph mgr
|
|
|
|
systemd:
|
|
|
|
name: ceph-mgr@{{ ansible_hostname }}
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
ignore_errors: True # if no mgr collocated with mons
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-16 21:40:35 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: restart containerized ceph mon
|
|
|
|
systemd:
|
2018-08-09 17:32:53 +08:00
|
|
|
name: ceph-mon@{{ monitor_name }}
|
2016-11-16 16:35:09 +08:00
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
2017-10-16 20:15:43 +08:00
|
|
|
daemon_reload: yes
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-10-07 06:46:46 +08:00
|
|
|
- name: non container | waiting for the monitor to join the quorum...
|
2019-04-17 20:02:06 +08:00
|
|
|
command: ceph --cluster "{{ cluster }}" -m "{{ hostvars[groups[mon_group_name][0]]['_current_monitor_address'] }}" -s --format json
|
2017-09-29 06:10:57 +08:00
|
|
|
register: ceph_health_raw
|
2019-04-17 19:57:29 +08:00
|
|
|
until:
|
|
|
|
- ceph_health_raw.rc == 0
|
|
|
|
- (hostvars[inventory_hostname]['ansible_hostname'] in (ceph_health_raw.stdout | default('{}') | from_json)["quorum_names"] or
|
|
|
|
hostvars[inventory_hostname]['ansible_fqdn'] in (ceph_health_raw.stdout | default('{}') | from_json)["quorum_names"])
|
2016-10-03 17:24:59 +08:00
|
|
|
retries: "{{ health_mon_check_retries }}"
|
|
|
|
delay: "{{ health_mon_check_delay }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-06 12:15:26 +08:00
|
|
|
|
2017-10-07 06:46:46 +08:00
|
|
|
- name: container | waiting for the containerized monitor to join the quorum...
|
2018-11-20 00:13:37 +08:00
|
|
|
command: >
|
2019-04-17 20:02:06 +08:00
|
|
|
{{ container_binary }} exec ceph-mon-{{ ansible_hostname }} ceph --cluster "{{ cluster }}" -m "{{ hostvars[groups[mon_group_name][0]]['_current_monitor_address'] }}" -s --format json
|
2017-09-29 06:10:57 +08:00
|
|
|
register: ceph_health_raw
|
2019-04-17 20:02:06 +08:00
|
|
|
until:
|
2019-04-17 19:57:29 +08:00
|
|
|
- ceph_health_raw.rc == 0
|
|
|
|
- (hostvars[inventory_hostname]['ansible_hostname'] in (ceph_health_raw.stdout | default('{}') | from_json)["quorum_names"] or
|
|
|
|
hostvars[inventory_hostname]['ansible_fqdn'] in (ceph_health_raw.stdout | default('{}') | from_json)["quorum_names"])
|
2016-10-03 17:24:59 +08:00
|
|
|
retries: "{{ health_mon_check_retries }}"
|
|
|
|
delay: "{{ health_mon_check_delay }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2019-03-20 18:44:11 +08:00
|
|
|
- name: upgrade ceph mgr nodes when implicitly collocated on monitors
|
|
|
|
vars:
|
|
|
|
health_mon_check_retries: 5
|
|
|
|
health_mon_check_delay: 15
|
|
|
|
upgrade_ceph_packages: True
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}"
|
2019-03-20 18:44:11 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
|
|
|
tasks:
|
|
|
|
- name: upgrade mgrs when no mgr group explicitly defined in inventory
|
2019-04-01 23:46:15 +08:00
|
|
|
when: groups.get(mgr_group_name, []) | length == 0
|
2019-03-20 18:44:11 +08:00
|
|
|
block:
|
|
|
|
- name: stop ceph mgr
|
|
|
|
systemd:
|
|
|
|
name: ceph-mgr@{{ ansible_hostname }}
|
|
|
|
state: stopped
|
|
|
|
masked: yes
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2019-03-20 18:44:11 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2019-03-20 18:44:11 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mgr
|
|
|
|
|
|
|
|
- name: upgrade ceph mgr nodes
|
2017-10-16 20:15:43 +08:00
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
2018-06-13 18:14:52 +08:00
|
|
|
ceph_release: "{{ ceph_stable_release }}"
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mgr_group_name|default('mgrs') }}"
|
2017-10-16 20:15:43 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2018-05-11 01:38:55 +08:00
|
|
|
# The following task has a failed_when: false
|
|
|
|
# to handle the scenario where no mgr existed before the upgrade
|
|
|
|
# or if we run a Ceph cluster before Luminous
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: stop ceph mgr
|
|
|
|
systemd:
|
|
|
|
name: ceph-mgr@{{ ansible_hostname }}
|
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2017-10-16 20:15:43 +08:00
|
|
|
failed_when: false
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mgr
|
2017-10-16 20:15:43 +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
|
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ osd_group_name|default('osds') }}"
|
2017-05-12 21:59:52 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2018-08-13 21:59:25 +08:00
|
|
|
- name: get osd numbers - non container
|
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
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-15 04:25:46 +08:00
|
|
|
|
2018-08-13 21:59:25 +08:00
|
|
|
- name: get osd unit names - container
|
2019-03-12 23:22:03 +08:00
|
|
|
shell: systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([a-z0-9]+).service"
|
2018-08-13 21:59:25 +08:00
|
|
|
register: osd_names
|
|
|
|
changed_when: false
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-08-13 21:59:25 +08:00
|
|
|
|
2019-03-29 03:34:48 +08:00
|
|
|
- name: set num_osds for container
|
|
|
|
set_fact:
|
|
|
|
num_osds: "{{ osd_names.stdout_lines|default([])|length }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2019-03-29 03:34:48 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: stop ceph osd
|
|
|
|
systemd:
|
|
|
|
name: ceph-osd@{{ item }}
|
2016-11-15 04:25:46 +08:00
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2016-11-15 04:25:46 +08:00
|
|
|
with_items: "{{ osd_ids.stdout_lines }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-15 04:25:46 +08:00
|
|
|
|
2019-03-29 03:34:48 +08:00
|
|
|
- name: set num_osds for non container
|
|
|
|
set_fact:
|
|
|
|
num_osds: "{{ osd_ids.stdout_lines|default([])|length }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2019-03-29 03:34:48 +08:00
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-osd
|
2015-03-27 01:51:11 +08:00
|
|
|
|
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
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: start ceph osd
|
|
|
|
systemd:
|
|
|
|
name: ceph-osd@{{ item }}
|
2016-11-15 04:25:46 +08:00
|
|
|
state: started
|
2016-06-15 23:08:15 +08:00
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2016-06-15 23:08:15 +08:00
|
|
|
with_items: "{{ osd_ids.stdout_lines }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-06 12:15:26 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: restart containerized ceph osd
|
|
|
|
systemd:
|
2018-08-13 21:59:25 +08:00
|
|
|
name: "{{ item }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2017-10-16 20:15:43 +08:00
|
|
|
daemon_reload: yes
|
2018-08-13 21:59:25 +08:00
|
|
|
with_items: "{{ osd_names.stdout_lines }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2019-03-20 04:08:32 +08:00
|
|
|
- name: scan ceph-disk osds with ceph-volume if deploying nautilus
|
|
|
|
command: "ceph-volume --cluster={{ cluster }} simple scan"
|
|
|
|
environment:
|
|
|
|
CEPH_VOLUME_DEBUG: 1
|
|
|
|
when:
|
|
|
|
- ceph_release in ["nautilus", "octopus"]
|
2019-05-22 16:02:42 +08:00
|
|
|
- not containerized_deployment | bool
|
2019-03-20 04:08:32 +08:00
|
|
|
|
|
|
|
- name: activate scanned ceph-disk osds and migrate to ceph-volume if deploying nautilus
|
|
|
|
command: "ceph-volume --cluster={{ cluster }} simple activate --all"
|
|
|
|
environment:
|
|
|
|
CEPH_VOLUME_DEBUG: 1
|
|
|
|
when:
|
|
|
|
- ceph_release in ["nautilus", "octopus"]
|
2019-05-22 16:02:42 +08:00
|
|
|
- not containerized_deployment | bool
|
2019-03-20 04:08:32 +08:00
|
|
|
|
2019-05-14 20:51:32 +08:00
|
|
|
- name: set_fact container_exec_cmd_osd
|
2017-10-08 20:45:48 +08:00
|
|
|
set_fact:
|
2019-05-14 20:51:32 +08:00
|
|
|
container_exec_cmd_update_osd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2017-10-08 20:45:48 +08:00
|
|
|
|
2018-07-23 20:56:20 +08:00
|
|
|
- name: get osd versions
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} versions"
|
2018-07-23 20:56:20 +08:00
|
|
|
register: ceph_versions
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
|
|
|
- name: set_fact ceph_versions_osd
|
|
|
|
set_fact:
|
|
|
|
ceph_versions_osd: "{{ (ceph_versions.stdout|from_json).osd }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
|
|
|
# length == 1 means there is a single osds versions entry
|
|
|
|
# thus all the osds are running the same version
|
|
|
|
- name: osd set sortbitwise
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} osd set sortbitwise"
|
2018-07-23 20:56:20 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
|
|
|
- (ceph_versions.get('stdout', '{}')|from_json).get('osd', {}) | length == 1
|
2018-10-06 06:53:40 +08:00
|
|
|
- ceph_versions_osd | string is search("ceph version 10")
|
2018-07-23 20:56:20 +08:00
|
|
|
|
2017-10-08 20:45:48 +08:00
|
|
|
- name: get num_pgs - non container
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} -s --format json"
|
2017-10-08 20:45:48 +08:00
|
|
|
register: ceph_pgs
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
|
2017-10-08 20:45:48 +08:00
|
|
|
- name: waiting for clean pgs...
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} -s --format json"
|
2017-09-28 20:46:26 +08:00
|
|
|
register: ceph_health_post
|
|
|
|
until: >
|
2018-09-25 20:21:44 +08:00
|
|
|
(((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | length) > 0)
|
|
|
|
and
|
|
|
|
(((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | selectattr('state_name', 'search', '^active\\+clean') | map(attribute='count') | list | sum) == (ceph_pgs.stdout | from_json).pgmap.num_pgs)
|
2017-09-28 20:46:26 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
retries: "{{ health_osd_check_retries }}"
|
|
|
|
delay: "{{ health_osd_check_delay }}"
|
2019-04-01 23:46:15 +08:00
|
|
|
when: (ceph_pgs.stdout | from_json).pgmap.num_pgs != 0
|
2017-10-08 20:45:48 +08:00
|
|
|
|
2017-05-12 21:59:52 +08:00
|
|
|
|
|
|
|
- name: unset osd flags
|
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}"
|
2017-05-12 21:59:52 +08:00
|
|
|
|
|
|
|
become: True
|
|
|
|
|
|
|
|
tasks:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2018-10-01 23:43:24 +08:00
|
|
|
|
2019-05-14 20:51:32 +08:00
|
|
|
- name: set_fact container_exec_cmd_osd
|
2017-09-29 18:05:43 +08:00
|
|
|
set_fact:
|
2019-05-14 20:51:32 +08:00
|
|
|
container_exec_cmd_update_osd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2016-11-06 12:15:26 +08:00
|
|
|
|
2017-09-29 18:05:43 +08:00
|
|
|
- name: unset osd flags
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_update_osd|default('') }} ceph osd unset {{ item }} --cluster {{ cluster }}"
|
2016-11-06 12:15:26 +08:00
|
|
|
with_items:
|
|
|
|
- noout
|
2018-05-30 15:55:18 +08:00
|
|
|
- norebalance
|
2017-03-24 14:40:15 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-09-28 21:27:27 +08:00
|
|
|
- name: get osd versions
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} versions"
|
2017-09-28 21:27:27 +08:00
|
|
|
register: ceph_versions
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
|
|
|
- name: set_fact ceph_versions_osd
|
|
|
|
set_fact:
|
|
|
|
ceph_versions_osd: "{{ (ceph_versions.stdout|from_json).osd }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
|
|
|
# length == 1 means there is a single osds versions entry
|
|
|
|
# thus all the osds are running the same version
|
|
|
|
- name: complete osds upgrade
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} osd require-osd-release luminous"
|
2017-09-28 21:27:27 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
2018-01-25 23:57:45 +08:00
|
|
|
- (ceph_versions.get('stdout', '{}')|from_json).get('osd', {}) | length == 1
|
2018-10-06 06:53:40 +08:00
|
|
|
- ceph_versions_osd | string is search("ceph version 12")
|
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
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mds_group_name|default('mdss') }}"
|
2016-10-06 19:56:37 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: stop ceph mds
|
|
|
|
systemd:
|
2016-11-15 04:42:52 +08:00
|
|
|
name: ceph-mds@{{ ansible_hostname }}
|
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-15 04:42:52 +08:00
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mds
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: start ceph mds
|
|
|
|
systemd:
|
2016-06-15 23:08:15 +08:00
|
|
|
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
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-16 16:35:09 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: restart ceph mds
|
|
|
|
systemd:
|
2016-11-16 16:35:09 +08:00
|
|
|
name: ceph-mds@{{ ansible_hostname }}
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2017-10-16 20:15:43 +08:00
|
|
|
daemon_reload: yes
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
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
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ rgw_group_name|default('rgws') }}"
|
2016-10-06 19:56:37 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2019-03-25 21:50:09 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
- name: stop ceph rgw when upgrading from stable-3.2
|
2017-10-16 20:15:43 +08:00
|
|
|
systemd:
|
2016-11-06 12:15:26 +08:00
|
|
|
name: ceph-radosgw@rgw.{{ ansible_hostname }}
|
2016-11-15 04:44:55 +08:00
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2019-03-25 21:50:09 +08:00
|
|
|
ignore_errors: True
|
|
|
|
|
|
|
|
- name: stop ceph rgw
|
|
|
|
systemd:
|
|
|
|
name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
masked: yes
|
|
|
|
with_items: "{{ rgw_instances }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-15 04:44:55 +08:00
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-rgw
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: restart containerized ceph rgw
|
|
|
|
systemd:
|
2019-01-22 18:12:37 +08:00
|
|
|
name: ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}
|
2016-11-06 12:15:26 +08:00
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2017-10-16 20:15:43 +08:00
|
|
|
daemon_reload: yes
|
2019-01-22 18:12:37 +08:00
|
|
|
with_items: "{{ rgw_instances }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2017-07-29 04:27:02 +08:00
|
|
|
|
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: upgrade ceph rbd mirror node
|
2017-07-29 04:27:02 +08:00
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ rbd_mirror_group_name|default('rbdmirrors') }}"
|
2017-07-29 04:27:02 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2019-03-21 16:00:02 +08:00
|
|
|
- name: stop ceph rbd mirror
|
2017-10-16 20:15:43 +08:00
|
|
|
systemd:
|
|
|
|
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2017-10-16 20:15:43 +08:00
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-rbd-mirror
|
2017-10-03 18:25:12 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: start ceph rbd mirror
|
|
|
|
systemd:
|
|
|
|
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2017-10-16 20:15:43 +08:00
|
|
|
|
|
|
|
- name: restart containerized ceph rbd mirror
|
|
|
|
systemd:
|
|
|
|
name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2017-10-16 20:15:43 +08:00
|
|
|
daemon_reload: yes
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2017-10-03 18:25:12 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
|
|
|
|
- name: upgrade ceph nfs node
|
2017-10-03 18:25:12 +08:00
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ nfs_group_name|default('nfss') }}"
|
2017-10-03 18:25:12 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2018-01-06 00:06:53 +08:00
|
|
|
# failed_when: false is here so that if we upgrade
|
|
|
|
# from a version of ceph that does not have nfs-ganesha
|
|
|
|
# then this task will not fail
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: stop ceph nfs
|
|
|
|
systemd:
|
|
|
|
name: nfs-ganesha
|
2017-10-03 18:25:12 +08:00
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2018-01-06 00:06:53 +08:00
|
|
|
failed_when: false
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2017-10-03 18:25:12 +08:00
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-nfs
|
2017-10-03 18:25:12 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: start nfs gateway
|
|
|
|
systemd:
|
|
|
|
name: nfs-ganesha
|
2017-10-03 18:25:12 +08:00
|
|
|
state: started
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2017-10-03 18:25:12 +08:00
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- not containerized_deployment | bool
|
|
|
|
- ceph_nfs_enable_service | bool
|
2017-10-03 18:25:12 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: systemd restart nfs container
|
|
|
|
systemd:
|
|
|
|
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}
|
2017-10-03 18:25:12 +08:00
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2017-10-16 20:15:43 +08:00
|
|
|
daemon_reload: yes
|
2017-10-03 18:25:12 +08:00
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- ceph_nfs_enable_service | bool
|
|
|
|
- containerized_deployment | bool
|
2017-10-03 18:25:12 +08:00
|
|
|
|
|
|
|
|
2018-05-11 06:57:59 +08:00
|
|
|
- name: upgrade ceph iscsi gateway node
|
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
|
|
|
hosts:
|
2018-06-06 12:07:33 +08:00
|
|
|
- "{{ iscsi_gw_group_name|default('iscsigws') }}"
|
2018-08-20 21:53:03 +08:00
|
|
|
- iscsi-gws # for backward compatibility only!
|
2018-05-11 06:57:59 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2018-05-11 06:57:59 +08:00
|
|
|
# failed_when: false is here so that if we upgrade
|
|
|
|
# from a version of ceph that does not have iscsi gws
|
|
|
|
# then this task will not fail
|
2019-04-24 02:58:37 +08:00
|
|
|
- name: stop ceph iscsi services
|
2018-05-11 06:57:59 +08:00
|
|
|
systemd:
|
2019-04-24 02:58:37 +08:00
|
|
|
name: '{{ item }}'
|
2018-05-11 06:57:59 +08:00
|
|
|
state: stopped
|
2019-03-20 18:35:36 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2018-05-11 06:57:59 +08:00
|
|
|
failed_when: false
|
2019-04-24 02:58:37 +08:00
|
|
|
with_items:
|
|
|
|
- rbd-target-api
|
|
|
|
- rbd-target-gw
|
2019-05-10 03:52:08 +08:00
|
|
|
- tcmu-runner
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-05-11 06:57:59 +08:00
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-iscsi-gw
|
2018-05-11 06:57:59 +08:00
|
|
|
|
2019-04-24 02:58:37 +08:00
|
|
|
- name: start ceph iscsi services
|
2018-05-11 06:57:59 +08:00
|
|
|
systemd:
|
2019-04-24 02:58:37 +08:00
|
|
|
name: '{{ item }}'
|
2018-05-11 06:57:59 +08:00
|
|
|
state: started
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2019-04-24 02:58:37 +08:00
|
|
|
with_items:
|
|
|
|
- tcmu-runner
|
|
|
|
- rbd-target-api
|
|
|
|
- rbd-target-gw
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-05-11 06:57:59 +08:00
|
|
|
|
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
- name: upgrade ceph client node
|
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ client_group_name|default('clients') }}"
|
2019-01-18 16:03:40 +08:00
|
|
|
serial: "{{ client_update_batch | default(20) }}"
|
2017-10-16 20:15:43 +08:00
|
|
|
become: True
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-client
|
2017-10-16 20:15:43 +08:00
|
|
|
|
2019-03-20 20:25:26 +08:00
|
|
|
- name: complete upgrade
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: all
|
2019-03-20 20:25:26 +08:00
|
|
|
become: True
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
- name: container | disallow pre-nautilus OSDs and enable all new nautilus-only functionality
|
|
|
|
command: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph osd require-osd-release nautilus"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: True
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2019-03-20 20:25:26 +08:00
|
|
|
|
|
|
|
- name: non container | disallow pre-nautilus OSDs and enable all new nautilus-only functionality
|
2019-03-29 05:05:09 +08:00
|
|
|
command: "ceph --cluster {{ cluster }} osd require-osd-release nautilus"
|
2019-03-20 20:25:26 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: True
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2017-10-16 20:15:43 +08:00
|
|
|
|
2019-03-20 20:22:46 +08:00
|
|
|
- name: container | enable msgr2 protocol
|
|
|
|
command: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph mon enable-msgr2"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: True
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2019-03-20 20:22:46 +08:00
|
|
|
|
|
|
|
- name: non container | enable msgr2 protocol
|
2019-03-29 05:05:09 +08:00
|
|
|
command: "ceph --cluster {{ cluster }} mon enable-msgr2"
|
2019-03-20 20:22:46 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: True
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2019-03-20 20:22:46 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- name: import_role ceph-config
|
|
|
|
import_role:
|
|
|
|
name: ceph-config
|
|
|
|
vars:
|
|
|
|
msgr2_migration: True
|
|
|
|
|
|
|
|
|
2017-10-03 18:25:12 +08:00
|
|
|
- name: show ceph status
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}"
|
2017-10-03 18:25:12 +08:00
|
|
|
become: True
|
|
|
|
tasks:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-11-20 00:13:37 +08:00
|
|
|
|
2019-05-14 20:51:32 +08:00
|
|
|
- name: set_fact container_exec_cmd_status
|
2017-10-03 18:25:12 +08:00
|
|
|
set_fact:
|
2019-05-14 20:51:32 +08:00
|
|
|
container_exec_cmd_status: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2017-10-03 18:25:12 +08:00
|
|
|
|
|
|
|
- name: show ceph status
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_status|default('') }} ceph --cluster {{ cluster }} -s"
|
2019-03-21 02:11:32 +08:00
|
|
|
run_once: True
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
|
|
|
- name: show all daemons version
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd_status|default('') }} ceph --cluster {{ cluster }} versions"
|
2019-03-21 02:11:32 +08:00
|
|
|
run_once: True
|
2017-10-03 18:25:12 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|