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
|
|
|
|
#
|
2021-06-28 23:01:22 +08:00
|
|
|
# If you run Red Hat Ceph Storage and are doing a **major** update (e.g: from 2 to 3), you have to change the ceph_rhcs_version to a newer one
|
2017-09-14 05:46:29 +08:00
|
|
|
#
|
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
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: always
|
2017-12-16 00:39:32 +08:00
|
|
|
become: false
|
2021-08-17 22:07:03 +08:00
|
|
|
gather_facts: 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'
|
|
|
|
|
2021-03-12 16:26:16 +08:00
|
|
|
- name: import_role ceph-defaults
|
|
|
|
import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- name: check if a legacy grafana-server group exists
|
|
|
|
import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: convert_grafana_server_group_name.yml
|
|
|
|
when: groups.get((grafana_server_group_name | default('grafana-server')), []) | length > 0
|
|
|
|
|
2016-11-16 16:35:09 +08:00
|
|
|
|
2016-10-26 05:56:58 +08:00
|
|
|
- name: gather facts and check the init system
|
|
|
|
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') }}"
|
2020-05-01 04:06:55 +08:00
|
|
|
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
2017-10-16 20:15:43 +08:00
|
|
|
- "{{ 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') }}"
|
2020-07-25 06:05:41 +08:00
|
|
|
- "{{ monitoring_group_name|default('monitoring') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: always
|
2020-06-29 22:52:28 +08:00
|
|
|
any_errors_fatal: True
|
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
|
|
|
|
2019-10-04 17:58:28 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
2017-10-19 00:03:30 +08:00
|
|
|
- name: gather facts
|
|
|
|
setup:
|
2020-06-30 22:13:42 +08:00
|
|
|
gather_subset:
|
|
|
|
- 'all'
|
|
|
|
- '!facter'
|
|
|
|
- '!ohai'
|
2019-10-02 21:36:30 +08:00
|
|
|
when: not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, [])
|
2017-10-19 00:03:30 +08:00
|
|
|
|
|
|
|
- name: gather and delegate facts
|
|
|
|
setup:
|
2020-06-30 22:13:42 +08:00
|
|
|
gather_subset:
|
|
|
|
- 'all'
|
|
|
|
- '!facter'
|
|
|
|
- '!ohai'
|
2017-10-19 00:03:30 +08:00
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
delegate_facts: True
|
2019-10-02 21:36:30 +08:00
|
|
|
with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}"
|
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
|
|
|
|
2021-10-29 05:40:18 +08:00
|
|
|
- name: set_fact rolling_update
|
|
|
|
set_fact:
|
|
|
|
rolling_update: true
|
|
|
|
|
2019-12-05 00:17:36 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-infra
|
|
|
|
|
2020-09-10 23:27:37 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-validate
|
|
|
|
|
2021-02-04 06:39:49 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
when:
|
|
|
|
- (group_names != ['clients']) or (inventory_hostname == groups.get('clients', [''])|first)
|
|
|
|
- (containerized_deployment | bool) or (dashboard_enabled | bool)
|
|
|
|
|
2020-01-10 03:57:08 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-common
|
|
|
|
tasks_from: registry
|
|
|
|
when:
|
2020-09-10 23:27:37 +08:00
|
|
|
- (group_names != ['clients']) or (inventory_hostname == groups.get('clients', [''])|first)
|
2021-02-04 06:39:49 +08:00
|
|
|
- (containerized_deployment | bool) or (dashboard_enabled | bool)
|
2020-01-10 03:57:08 +08:00
|
|
|
- ceph_docker_registry_auth | bool
|
|
|
|
|
2021-07-26 17:19:36 +08:00
|
|
|
- name: check ceph release in container image
|
2021-07-30 00:26:33 +08:00
|
|
|
when:
|
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
|
|
|
- containerized_deployment | bool
|
2021-07-26 17:19:36 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: true
|
|
|
|
block:
|
|
|
|
- name: get the ceph release being deployed
|
|
|
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} --version"
|
|
|
|
register: ceph_version
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: check ceph release being deployed
|
|
|
|
fail:
|
|
|
|
msg: "This version of ceph-ansible is intended for upgrading to Ceph Quincy only."
|
|
|
|
when: "'quincy' not in ceph_version.stdout.split()"
|
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
|
2016-10-06 19:56:37 +08:00
|
|
|
- name: upgrade ceph mon cluster
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: mons
|
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
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2021-03-18 16:08:51 +08:00
|
|
|
- name: upgrade ceph mon cluster
|
|
|
|
block:
|
|
|
|
- name: remove ceph aliases
|
|
|
|
file:
|
|
|
|
path: /etc/profile.d/ceph-aliases.sh
|
|
|
|
state: absent
|
|
|
|
when: containerized_deployment | bool
|
2019-03-15 22:18:48 +08:00
|
|
|
|
2021-03-18 16:08:51 +08:00
|
|
|
- name: set mon_host_count
|
|
|
|
set_fact:
|
|
|
|
mon_host_count: "{{ groups[mon_group_name] | length }}"
|
2016-11-15 03:04:43 +08:00
|
|
|
|
2021-03-18 16:08:51 +08:00
|
|
|
- name: fail when less than three monitors
|
|
|
|
fail:
|
|
|
|
msg: "Upgrade of cluster with less than three monitors is not supported."
|
|
|
|
when: mon_host_count | int < 3
|
2019-03-20 16:46:21 +08:00
|
|
|
|
2021-03-18 16:08:51 +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
|
|
|
|
2021-03-18 16:08:51 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2019-06-10 22:26:18 +08:00
|
|
|
|
|
|
|
- block:
|
2021-03-18 16:08:51 +08:00
|
|
|
- name: get ceph cluster status
|
|
|
|
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} health -f json"
|
|
|
|
register: check_cluster_health
|
2019-06-10 22:26:18 +08:00
|
|
|
delegate_to: "{{ mon_host }}"
|
|
|
|
|
2021-03-18 16:08:51 +08:00
|
|
|
- block:
|
|
|
|
- name: display ceph health detail
|
|
|
|
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} health detail"
|
|
|
|
delegate_to: "{{ mon_host }}"
|
|
|
|
|
|
|
|
- name: fail if cluster isn't in an acceptable state
|
|
|
|
fail:
|
|
|
|
msg: "cluster is not in an acceptable state!"
|
|
|
|
when: (check_cluster_health.stdout | from_json).status == 'HEALTH_ERR'
|
2021-07-10 04:09:49 +08:00
|
|
|
|
|
|
|
- name: get the ceph quorum status
|
|
|
|
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} quorum_status -f json"
|
|
|
|
register: check_quorum_status
|
|
|
|
delegate_to: "{{ mon_host }}"
|
|
|
|
|
|
|
|
- name: fail if the cluster quorum isn't in an acceptable state
|
|
|
|
fail:
|
|
|
|
msg: "cluster quorum is not in an acceptable state!"
|
|
|
|
when: (check_quorum_status.stdout | from_json).quorum | length != groups[mon_group_name] | length
|
2021-03-18 16:08:51 +08:00
|
|
|
when: inventory_hostname == groups[mon_group_name] | first
|
|
|
|
|
|
|
|
- name: ensure /var/lib/ceph/bootstrap-rbd-mirror is present
|
|
|
|
file:
|
|
|
|
path: /var/lib/ceph/bootstrap-rbd-mirror
|
|
|
|
owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
mode: '755'
|
|
|
|
state: directory
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
with_items: "{{ groups[mon_group_name] }}"
|
|
|
|
when:
|
|
|
|
- cephx | bool
|
|
|
|
- inventory_hostname == groups[mon_group_name][0]
|
|
|
|
|
|
|
|
- name: create potentially missing keys (rbd and rbd-mirror)
|
|
|
|
ceph_key:
|
|
|
|
name: "client.{{ item.0 }}"
|
|
|
|
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 | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
|
|
|
when:
|
|
|
|
- cephx | bool
|
|
|
|
- inventory_hostname == groups[mon_group_name][0]
|
|
|
|
|
|
|
|
# NOTE: we mask the service so the RPM can't restart it
|
|
|
|
# after the package gets upgraded
|
|
|
|
- name: stop ceph mon
|
|
|
|
systemd:
|
|
|
|
name: ceph-mon@{{ item }}
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
masked: yes
|
|
|
|
with_items:
|
|
|
|
- "{{ ansible_facts['hostname'] }}"
|
|
|
|
- "{{ ansible_facts['fqdn'] }}"
|
2018-10-16 21:40:35 +08:00
|
|
|
|
2021-03-18 16:08:51 +08:00
|
|
|
# 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_facts['hostname'] }}
|
|
|
|
masked: yes
|
|
|
|
when: inventory_hostname in groups[mgr_group_name] | default([])
|
|
|
|
or groups[mgr_group_name] | default([]) | length == 0
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2021-03-18 16:08:51 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
|
|
|
when: not containerized_deployment | bool
|
|
|
|
- import_role:
|
|
|
|
name: ceph-container-common
|
|
|
|
when: containerized_deployment | bool
|
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mon
|
|
|
|
|
|
|
|
- name: start ceph mgr
|
|
|
|
systemd:
|
|
|
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
masked: no
|
|
|
|
when: inventory_hostname in groups[mgr_group_name] | default([])
|
|
|
|
or groups[mgr_group_name] | default([]) | length == 0
|
|
|
|
|
2021-10-28 22:17:24 +08:00
|
|
|
- name: import_role ceph-facts
|
|
|
|
import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: set_monitor_address.yml
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
delegate_facts: true
|
|
|
|
|
2021-03-18 16:08:51 +08:00
|
|
|
- name: non container | waiting for the monitor to join the quorum...
|
|
|
|
command: ceph --cluster "{{ cluster }}" -m "{{ hostvars[groups[mon_group_name][0]]['_current_monitor_address'] }}" quorum_status --format json
|
|
|
|
register: ceph_health_raw
|
|
|
|
until:
|
|
|
|
- ceph_health_raw.rc == 0
|
|
|
|
- (hostvars[inventory_hostname]['ansible_facts']['hostname'] in (ceph_health_raw.stdout | default('{}') | from_json)["quorum_names"] or
|
|
|
|
hostvars[inventory_hostname]['ansible_facts']['fqdn'] in (ceph_health_raw.stdout | default('{}') | from_json)["quorum_names"])
|
|
|
|
retries: "{{ health_mon_check_retries }}"
|
|
|
|
delay: "{{ health_mon_check_delay }}"
|
|
|
|
when: not containerized_deployment | bool
|
|
|
|
|
|
|
|
- name: container | waiting for the containerized monitor to join the quorum...
|
|
|
|
command: >
|
|
|
|
{{ container_binary }} exec ceph-mon-{{ ansible_facts['hostname'] }} ceph --cluster "{{ cluster }}" -m "{{ hostvars[groups[mon_group_name][0]]['_current_monitor_address'] }}" quorum_status --format json
|
|
|
|
register: ceph_health_raw
|
|
|
|
until:
|
|
|
|
- ceph_health_raw.rc == 0
|
|
|
|
- (hostvars[inventory_hostname]['ansible_facts']['hostname'] in (ceph_health_raw.stdout | default('{}') | from_json)["quorum_names"] or
|
|
|
|
hostvars[inventory_hostname]['ansible_facts']['fqdn'] in (ceph_health_raw.stdout | default('{}') | from_json)["quorum_names"])
|
|
|
|
retries: "{{ health_mon_check_retries }}"
|
|
|
|
delay: "{{ health_mon_check_delay }}"
|
|
|
|
when: containerized_deployment | bool
|
|
|
|
rescue:
|
|
|
|
- name: unmask the mon service
|
|
|
|
systemd:
|
2021-03-26 23:12:42 +08:00
|
|
|
name: ceph-mon@{{ ansible_facts['hostname'] }}
|
2021-03-18 16:08:51 +08:00
|
|
|
enabled: yes
|
|
|
|
masked: no
|
|
|
|
|
|
|
|
- name: unmask the mgr service
|
|
|
|
systemd:
|
|
|
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
|
|
|
masked: no
|
|
|
|
when: inventory_hostname in groups[mgr_group_name] | default([])
|
|
|
|
or groups[mgr_group_name] | default([]) | length == 0
|
2019-09-27 22:24:58 +08:00
|
|
|
|
2021-03-26 23:12:42 +08:00
|
|
|
- name: stop the playbook execution
|
|
|
|
fail:
|
|
|
|
msg: "There was an error during monitor upgrade. Please, check the previous task results."
|
|
|
|
|
2019-09-27 22:24:58 +08:00
|
|
|
- name: reset mon_host
|
|
|
|
hosts: "{{ mon_group_name|default('mons') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: always
|
2019-09-27 22:24:58 +08:00
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-09-27 22:24:58 +08:00
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- name: reset mon_host fact
|
|
|
|
set_fact:
|
2019-10-26 01:36:07 +08:00
|
|
|
mon_host: "{{ groups[mon_group_name][0] }}"
|
2019-09-27 22:24:58 +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') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: mgrs
|
2019-03-20 18:44:11 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-03-20 18:44:11 +08:00
|
|
|
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:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
2019-03-20 18:44:11 +08:00
|
|
|
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') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: mgrs
|
2017-10-16 20:15:43 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
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:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
2017-10-16 20:15:43 +08:00
|
|
|
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
|
|
|
|
2019-11-19 00:59:56 +08:00
|
|
|
- name: set osd flags
|
2021-10-25 19:43:25 +08:00
|
|
|
hosts: "{{ osd_group_name | default('osds') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: osds
|
2019-11-19 00:59:56 +08:00
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-11-19 00:59:56 +08:00
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2020-04-03 21:07:54 +08:00
|
|
|
tasks_from: container_binary.yml
|
2019-11-19 00:59:56 +08:00
|
|
|
|
2021-10-25 19:43:25 +08:00
|
|
|
- name: set osd flags, disable autoscaler and balancer
|
2021-06-15 00:01:41 +08:00
|
|
|
run_once: true
|
2021-10-25 19:43:25 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
block:
|
|
|
|
- name: get pool list
|
|
|
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
|
|
|
|
register: pool_list
|
|
|
|
changed_when: false
|
|
|
|
check_mode: false
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2021-10-25 19:43:25 +08:00
|
|
|
- name: get balancer module status
|
|
|
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json"
|
|
|
|
register: balancer_status_update
|
|
|
|
run_once: true
|
|
|
|
changed_when: false
|
|
|
|
check_mode: false
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2021-10-25 19:43:25 +08:00
|
|
|
- name: set_fact pools_pgautoscaler_mode
|
|
|
|
set_fact:
|
|
|
|
pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
|
|
|
|
with_items: "{{ pool_list.stdout | default('{}') | from_json }}"
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2021-10-25 19:43:25 +08:00
|
|
|
- name: disable balancer
|
|
|
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"
|
|
|
|
changed_when: false
|
|
|
|
when: (balancer_status_update.stdout | from_json)['active'] | bool
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2021-10-25 19:43:25 +08:00
|
|
|
- name: disable pg autoscale on pools
|
|
|
|
ceph_pool:
|
|
|
|
name: "{{ item.name }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
pg_autoscale_mode: false
|
|
|
|
with_items: "{{ pools_pgautoscaler_mode }}"
|
|
|
|
when:
|
|
|
|
- pools_pgautoscaler_mode is defined
|
|
|
|
- item.mode == 'on'
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2021-10-25 19:43:25 +08:00
|
|
|
- name: set osd flags
|
|
|
|
ceph_osd_flag:
|
|
|
|
name: "{{ item }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- nodeep-scrub
|
2019-11-19 00:59:56 +08:00
|
|
|
|
2017-05-12 21:59:52 +08:00
|
|
|
- name: upgrade ceph osds cluster
|
|
|
|
vars:
|
2021-10-25 20:28:41 +08:00
|
|
|
health_osd_check_retries: 600
|
|
|
|
health_osd_check_delay: 2
|
2017-05-12 21:59:52 +08:00
|
|
|
upgrade_ceph_packages: True
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ osd_group_name|default('osds') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: osds
|
2017-05-12 21:59:52 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2019-06-18 16:08:48 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
2018-08-13 21:59:25 +08:00
|
|
|
- name: get osd numbers - non container
|
2020-12-01 00:08:18 +08:00
|
|
|
shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi # noqa 306
|
2016-11-15 04:25:46 +08:00
|
|
|
register: osd_ids
|
|
|
|
changed_when: false
|
2018-08-13 21:59:25 +08:00
|
|
|
|
2020-07-22 02:51:20 +08:00
|
|
|
- name: set num_osds
|
2019-03-29 03:34:48 +08:00
|
|
|
set_fact:
|
2020-07-22 02:51:20 +08:00
|
|
|
num_osds: "{{ osd_ids.stdout_lines|default([])|length }}"
|
2019-03-29 03:34:48 +08:00
|
|
|
|
2019-06-18 16:08:48 +08:00
|
|
|
- name: set_fact container_exec_cmd_osd
|
|
|
|
set_fact:
|
2021-03-03 22:43:50 +08:00
|
|
|
container_exec_cmd_update_osd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_facts']['hostname'] }}"
|
2019-06-18 16:08:48 +08:00
|
|
|
when: containerized_deployment | bool
|
|
|
|
|
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-03-29 03:34:48 +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-osd
|
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
|
2020-11-17 22:22:34 +08:00
|
|
|
ceph_volume_simple_scan:
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
force: true
|
2019-03-20 04:08:32 +08:00
|
|
|
environment:
|
2020-08-06 00:02:48 +08:00
|
|
|
CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}"
|
2020-11-10 06:02:17 +08:00
|
|
|
when: 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
|
2020-11-17 22:22:34 +08:00
|
|
|
ceph_volume_simple_activate:
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
osd_all: true
|
2019-03-20 04:08:32 +08:00
|
|
|
environment:
|
2020-08-06 00:02:48 +08:00
|
|
|
CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}"
|
2020-11-10 06:02:17 +08:00
|
|
|
when: not containerized_deployment | bool
|
2019-03-20 04:08:32 +08:00
|
|
|
|
2017-10-08 20:45:48 +08:00
|
|
|
- name: waiting for clean pgs...
|
2020-10-26 23:23:01 +08:00
|
|
|
command: "{{ container_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} pg stat --format json"
|
2017-09-28 20:46:26 +08:00
|
|
|
register: ceph_health_post
|
|
|
|
until: >
|
2020-10-26 23:23:01 +08:00
|
|
|
(((ceph_health_post.stdout | from_json).pg_summary.num_pg_by_state | length) > 0)
|
2018-09-25 20:21:44 +08:00
|
|
|
and
|
2021-02-04 23:24:03 +08:00
|
|
|
(((ceph_health_post.stdout | from_json).pg_summary.num_pg_by_state | selectattr('name', 'search', '^active\\+clean') | map(attribute='num') | list | sum) == (ceph_health_post.stdout | from_json).pg_summary.num_pgs)
|
2017-09-28 20:46:26 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2021-02-04 23:24:03 +08:00
|
|
|
changed_when: false
|
2016-11-06 12:15:26 +08:00
|
|
|
retries: "{{ health_osd_check_retries }}"
|
|
|
|
delay: "{{ health_osd_check_delay }}"
|
2017-10-08 20:45:48 +08:00
|
|
|
|
2017-05-12 21:59:52 +08:00
|
|
|
|
2019-06-18 16:08:48 +08:00
|
|
|
- name: complete osd upgrade
|
2021-10-25 19:43:25 +08:00
|
|
|
hosts: "{{ osd_group_name | default('osds') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: osds
|
2017-05-12 21:59:52 +08:00
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2017-05-12 21:59:52 +08:00
|
|
|
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
|
2020-04-03 21:07:54 +08:00
|
|
|
tasks_from: container_binary.yml
|
2018-10-01 23:43:24 +08:00
|
|
|
|
2021-10-25 19:43:25 +08:00
|
|
|
- name: unset osd flags, re-enable pg autoscaler and balancer
|
|
|
|
run_once: true
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
block:
|
|
|
|
- name: re-enable pg autoscale on pools
|
|
|
|
ceph_pool:
|
|
|
|
name: "{{ item.name }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
pg_autoscale_mode: true
|
|
|
|
with_items: "{{ pools_pgautoscaler_mode }}"
|
|
|
|
when:
|
|
|
|
- pools_pgautoscaler_mode is defined
|
|
|
|
- item.mode == 'on'
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2021-10-25 19:43:25 +08:00
|
|
|
- name: unset osd flags
|
|
|
|
ceph_osd_flag:
|
|
|
|
name: "{{ item }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
state: absent
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- nodeep-scrub
|
|
|
|
|
|
|
|
- name: re-enable balancer
|
|
|
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
|
|
|
|
changed_when: false
|
|
|
|
when: (balancer_status_update.stdout | from_json)['active'] | bool
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2019-10-11 01:09:49 +08:00
|
|
|
- name: upgrade ceph mdss cluster, deactivate all rank > 0
|
2020-09-08 19:16:33 +08:00
|
|
|
hosts: "{{ mon_group_name | default('mons') }}[0]"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: mdss
|
2019-10-11 01:09:49 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2019-10-23 21:48:32 +08:00
|
|
|
- name: deactivate all mds rank > 0
|
2019-10-24 01:39:15 +08:00
|
|
|
when: groups.get(mds_group_name, []) | length > 0
|
2019-10-23 21:48:32 +08:00
|
|
|
block:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2019-10-17 20:43:18 +08:00
|
|
|
|
2019-10-24 01:39:15 +08:00
|
|
|
- name: deactivate all mds rank > 0 if any
|
|
|
|
when: groups.get(mds_group_name, []) | length > 1
|
|
|
|
block:
|
|
|
|
- name: set max_mds 1 on ceph fs
|
2020-09-30 23:57:20 +08:00
|
|
|
ceph_fs:
|
|
|
|
name: "{{ cephfs }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
data: "{{ cephfs_data_pool.name }}"
|
|
|
|
metadata: "{{ cephfs_metadata_pool.name }}"
|
|
|
|
max_mds: 1
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2019-10-24 01:39:15 +08:00
|
|
|
|
|
|
|
- name: wait until only rank 0 is up
|
2020-10-23 23:46:30 +08:00
|
|
|
ceph_fs:
|
|
|
|
name: "{{ cephfs }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
state: info
|
2019-10-24 01:39:15 +08:00
|
|
|
register: wait_rank_zero
|
|
|
|
retries: 720
|
|
|
|
delay: 5
|
|
|
|
until: (wait_rank_zero.stdout | from_json).mdsmap.in | length == 1 and (wait_rank_zero.stdout | from_json).mdsmap.in[0] == 0
|
2020-10-23 23:46:30 +08:00
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2019-10-24 01:39:15 +08:00
|
|
|
|
|
|
|
- name: get name of remaining active mds
|
|
|
|
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs dump -f json"
|
|
|
|
changed_when: false
|
|
|
|
register: _mds_active_name
|
|
|
|
|
|
|
|
- name: set_fact mds_active_name
|
|
|
|
set_fact:
|
2019-10-26 04:47:50 +08:00
|
|
|
mds_active_name: "{{ (_mds_active_name.stdout | from_json)['filesystems'][0]['mdsmap']['info'][item.key]['name'] }}"
|
2019-10-30 01:01:50 +08:00
|
|
|
with_dict: "{{ (_mds_active_name.stdout | default('{}') | from_json).filesystems[0]['mdsmap']['info'] | default({}) }}"
|
2019-10-24 01:39:15 +08:00
|
|
|
|
2019-10-26 04:47:50 +08:00
|
|
|
- name: set_fact mds_active_host
|
|
|
|
set_fact:
|
|
|
|
mds_active_host: "{{ [hostvars[item]['inventory_hostname']] }}"
|
|
|
|
with_items: "{{ groups[mds_group_name] }}"
|
2021-03-03 22:43:50 +08:00
|
|
|
when: hostvars[item]['ansible_facts']['hostname'] == mds_active_name
|
2019-10-26 04:47:50 +08:00
|
|
|
|
2019-10-24 01:39:15 +08:00
|
|
|
- name: create standby_mdss group
|
|
|
|
add_host:
|
|
|
|
name: "{{ item }}"
|
|
|
|
groups: standby_mdss
|
|
|
|
ansible_host: "{{ hostvars[item]['ansible_host'] | default(omit) }}"
|
|
|
|
ansible_port: "{{ hostvars[item]['ansible_port'] | default(omit) }}"
|
2019-10-26 04:47:50 +08:00
|
|
|
with_items: "{{ groups[mds_group_name] | difference(mds_active_host) }}"
|
2019-10-24 01:39:15 +08:00
|
|
|
|
|
|
|
- name: stop standby ceph mds
|
|
|
|
systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: "ceph-mds@{{ hostvars[item]['ansible_facts']['hostname'] }}"
|
2019-10-24 01:39:15 +08:00
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
with_items: "{{ groups['standby_mdss'] }}"
|
|
|
|
when: groups['standby_mdss'] | default([]) | length > 0
|
|
|
|
|
|
|
|
# dedicated task for masking systemd unit
|
|
|
|
# somehow, having a single task doesn't work in containerized context
|
|
|
|
- name: mask systemd units for standby ceph mds
|
|
|
|
systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: "ceph-mds@{{ hostvars[item]['ansible_facts']['hostname'] }}"
|
2019-10-24 01:39:15 +08:00
|
|
|
masked: yes
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
with_items: "{{ groups['standby_mdss'] }}"
|
|
|
|
when: groups['standby_mdss'] | default([]) | length > 0
|
|
|
|
|
|
|
|
- name: wait until all standbys mds are stopped
|
|
|
|
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs dump -f json"
|
|
|
|
changed_when: false
|
|
|
|
register: wait_standbys_down
|
|
|
|
retries: 300
|
|
|
|
delay: 5
|
|
|
|
until: (wait_standbys_down.stdout | from_json).standbys | length == 0
|
2019-10-23 21:48:32 +08:00
|
|
|
|
|
|
|
- name: create active_mdss group
|
|
|
|
add_host:
|
2019-10-26 04:47:50 +08:00
|
|
|
name: "{{ mds_active_host[0] if mds_active_host is defined else groups.get(mds_group_name)[0] }}"
|
2019-10-23 21:48:32 +08:00
|
|
|
groups: active_mdss
|
2019-10-26 04:47:50 +08:00
|
|
|
ansible_host: "{{ hostvars[mds_active_host[0] if mds_active_host is defined else groups.get(mds_group_name)[0]]['ansible_host'] | default(omit) }}"
|
|
|
|
ansible_port: "{{ hostvars[mds_active_host[0] if mds_active_host is defined else groups.get(mds_group_name)[0]]['ansible_port'] | default(omit) }}"
|
2019-10-23 21:48:32 +08:00
|
|
|
|
2016-11-15 04:42:52 +08:00
|
|
|
|
2019-10-11 01:09:49 +08:00
|
|
|
- name: upgrade active mds
|
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
2019-10-26 05:03:46 +08:00
|
|
|
hosts: active_mdss
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: mdss
|
2019-10-11 01:09:49 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-10-11 01:09:49 +08:00
|
|
|
tasks:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2019-10-11 01:09:49 +08:00
|
|
|
|
2018-12-10 22:46:32 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2019-10-11 01:09:49 +08:00
|
|
|
|
|
|
|
- name: prevent restart from the packaging
|
|
|
|
systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-mds@{{ ansible_facts['hostname'] }}
|
2019-10-11 01:09:49 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2020-07-29 21:44:15 +08:00
|
|
|
when: not containerized_deployment | bool
|
2019-10-11 01:09:49 +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-mds
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2020-07-29 21:44:15 +08:00
|
|
|
- name: restart ceph mds
|
|
|
|
systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-mds@{{ ansible_facts['hostname'] }}
|
2020-07-29 21:44:15 +08:00
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
|
|
|
masked: no
|
|
|
|
when: not containerized_deployment | bool
|
|
|
|
|
|
|
|
- name: restart active mds
|
2021-03-03 22:43:50 +08:00
|
|
|
command: "{{ container_binary }} stop ceph-mds-{{ ansible_facts['hostname'] }}"
|
2020-07-29 21:44:15 +08:00
|
|
|
changed_when: false
|
|
|
|
when: containerized_deployment | bool
|
2019-10-11 01:09:49 +08:00
|
|
|
|
|
|
|
- name: upgrade standbys ceph mdss cluster
|
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
2019-10-26 05:03:46 +08:00
|
|
|
hosts: standby_mdss
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: mdss
|
2019-10-11 01:09:49 +08:00
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-10-11 01:09:49 +08:00
|
|
|
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
- name: prevent restarts from the packaging
|
|
|
|
systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-mds@{{ ansible_facts['hostname'] }}
|
2019-10-11 01:09:49 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2020-07-29 21:44:15 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-16 16:35:09 +08:00
|
|
|
|
2019-10-11 01:09:49 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
|
|
|
when: not containerized_deployment | bool
|
|
|
|
- import_role:
|
|
|
|
name: ceph-container-common
|
|
|
|
when: containerized_deployment | bool
|
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mds
|
|
|
|
|
|
|
|
- name: set max_mds
|
2020-09-30 23:57:20 +08:00
|
|
|
ceph_fs:
|
|
|
|
name: "{{ cephfs }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
max_mds: "{{ mds_max_mds }}"
|
|
|
|
data: "{{ cephfs_data_pool.name }}"
|
|
|
|
metadata: "{{ cephfs_metadata_pool.name }}"
|
2019-10-11 01:09:49 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2020-09-30 23:57:20 +08:00
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2019-10-11 01:09:49 +08:00
|
|
|
when: inventory_hostname == groups['standby_mdss'] | last
|
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') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: rgws
|
2016-10-06 19:56:37 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
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:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-radosgw@rgw.{{ ansible_facts['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:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-radosgw@rgw.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}
|
2019-03-25 21:50:09 +08:00
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
masked: yes
|
|
|
|
with_items: "{{ rgw_instances }}"
|
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-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
|
2020-05-01 04:06:55 +08:00
|
|
|
hosts: "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: rbdmirrors
|
2017-07-29 04:27:02 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
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:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_facts['hostname'] }}"
|
2017-10-16 20:15:43 +08:00
|
|
|
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: 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') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: nfss
|
2017-10-03 18:25:12 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
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
|
|
|
|
2020-07-22 02:51:20 +08:00
|
|
|
- name: systemd stop nfs container
|
|
|
|
systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_facts['hostname']) }}
|
2020-07-22 02:51:20 +08:00
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
masked: yes
|
|
|
|
failed_when: false
|
|
|
|
when:
|
|
|
|
- ceph_nfs_enable_service | bool
|
|
|
|
- containerized_deployment | bool
|
|
|
|
|
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
|
|
|
|
|
|
|
|
2018-05-11 06:57:59 +08:00
|
|
|
- name: upgrade ceph iscsi gateway node
|
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: True
|
2021-10-20 16:01:05 +08:00
|
|
|
hosts: "{{ iscsi_gw_group_name|default('iscsigws') }}"
|
|
|
|
tags: iscsigws
|
2018-05-11 06:57:59 +08:00
|
|
|
serial: 1
|
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
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
|
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
|
|
|
|
|
|
|
|
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') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: 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
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
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
|
2021-11-09 22:35:12 +08:00
|
|
|
tasks_from: container_binary.yml
|
|
|
|
when: containerized_deployment | bool
|
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
|
2020-09-10 23:27:37 +08:00
|
|
|
when:
|
|
|
|
- (group_names != ['clients']) or (inventory_hostname == groups.get('clients', [''])|first)
|
|
|
|
- containerized_deployment | bool
|
2021-11-09 22:35:12 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
|
2020-07-03 16:21:49 +08:00
|
|
|
- name: upgrade ceph-crash daemons
|
|
|
|
hosts:
|
|
|
|
- "{{ mon_group_name | default('mons') }}"
|
|
|
|
- "{{ osd_group_name | default('osds') }}"
|
|
|
|
- "{{ mds_group_name | default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name | default('rgws') }}"
|
|
|
|
- "{{ rbdmirror_group_name | default('rbdmirrors') }}"
|
|
|
|
- "{{ mgr_group_name | default('mgrs') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags:
|
|
|
|
- post_upgrade
|
|
|
|
- crash
|
2020-07-03 16:21:49 +08:00
|
|
|
gather_facts: false
|
|
|
|
become: true
|
|
|
|
tasks:
|
2020-07-22 02:51:20 +08:00
|
|
|
- name: stop the ceph-crash service
|
|
|
|
systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: "{{ 'ceph-crash@' + ansible_facts['hostname'] if containerized_deployment | bool else 'ceph-crash.service' }}"
|
2020-07-22 02:51:20 +08:00
|
|
|
state: stopped
|
2021-05-04 17:42:15 +08:00
|
|
|
|
|
|
|
# it needs to be done in a separate task otherwise the stop just before doesn't work.
|
|
|
|
- name: mask and disable the ceph-crash service
|
|
|
|
systemd:
|
|
|
|
name: "{{ 'ceph-crash@' + ansible_facts['hostname'] if containerized_deployment | bool else 'ceph-crash.service' }}"
|
2020-07-22 02:51:20 +08:00
|
|
|
enabled: no
|
|
|
|
masked: yes
|
2021-05-04 17:42:15 +08:00
|
|
|
|
2020-07-03 16:21:49 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- import_role:
|
|
|
|
name: ceph-crash
|
|
|
|
|
2019-03-20 20:25:26 +08:00
|
|
|
- name: complete upgrade
|
2020-09-25 22:20:35 +08:00
|
|
|
hosts: "{{ mon_group_name | default('mons') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: post_upgrade
|
2019-03-20 20:25:26 +08:00
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-03-20 20:25:26 +08:00
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2020-09-25 22:20:35 +08:00
|
|
|
tasks_from: container_binary.yml
|
2019-03-20 20:25:26 +08:00
|
|
|
|
2021-02-06 05:27:38 +08:00
|
|
|
- name: container | disallow pre-quincy OSDs and enable all new quincy-only functionality
|
2021-03-03 22:43:50 +08:00
|
|
|
command: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_facts']['hostname'] }} ceph --cluster {{ cluster }} osd require-osd-release quincy"
|
2019-03-20 20:25:26 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: True
|
2020-09-10 22:12:13 +08:00
|
|
|
when:
|
|
|
|
- containerized_deployment | bool
|
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
2019-03-20 20:25:26 +08:00
|
|
|
|
2021-02-06 05:27:38 +08:00
|
|
|
- name: non container | disallow pre-quincy OSDs and enable all new quincy-only functionality
|
|
|
|
command: "ceph --cluster {{ cluster }} osd require-osd-release quincy"
|
2019-03-20 20:25:26 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
run_once: True
|
2020-09-10 22:12:13 +08:00
|
|
|
when:
|
|
|
|
- not containerized_deployment | bool
|
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
2017-10-16 20:15:43 +08:00
|
|
|
|
2020-07-24 23:21:54 +08:00
|
|
|
- name: upgrade node-exporter
|
2021-02-04 02:07:24 +08:00
|
|
|
hosts:
|
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
|
|
|
- "{{ mgr_group_name|default('mgrs') }}"
|
|
|
|
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
|
|
|
- "{{ iscsi_gw_group_name|default('iscsigws') }}"
|
|
|
|
- "{{ monitoring_group_name|default('monitoring') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: monitoring
|
2020-07-24 23:21:54 +08:00
|
|
|
gather_facts: false
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- name: with dashboard configuration
|
|
|
|
when: dashboard_enabled | bool
|
|
|
|
block:
|
|
|
|
- name: stop node-exporter
|
|
|
|
service:
|
|
|
|
name: node_exporter
|
|
|
|
state: stopped
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
- import_role:
|
|
|
|
name: ceph-container-common
|
|
|
|
tasks_from: registry
|
|
|
|
when:
|
|
|
|
- not containerized_deployment | bool
|
|
|
|
- ceph_docker_registry_auth | bool
|
|
|
|
- import_role:
|
|
|
|
name: ceph-node-exporter
|
|
|
|
|
|
|
|
- name: upgrade monitoring node
|
2020-07-25 06:05:41 +08:00
|
|
|
hosts: "{{ monitoring_group_name }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: monitoring
|
2020-07-24 23:21:54 +08:00
|
|
|
gather_facts: false
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- name: with dashboard configuration
|
|
|
|
when: dashboard_enabled | bool
|
|
|
|
block:
|
|
|
|
- name: stop monitoring services
|
|
|
|
service:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: stopped
|
|
|
|
failed_when: false
|
|
|
|
with_items:
|
|
|
|
- alertmanager
|
|
|
|
- prometheus
|
|
|
|
- grafana-server
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: grafana
|
|
|
|
- import_role:
|
|
|
|
name: ceph-prometheus
|
|
|
|
- import_role:
|
|
|
|
name: ceph-grafana
|
|
|
|
|
|
|
|
- name: upgrade ceph dashboard
|
|
|
|
hosts: "{{ groups[mgr_group_name] | default(groups[mon_group_name]) | default(omit) }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: monitoring
|
2020-07-24 23:21:54 +08:00
|
|
|
gather_facts: false
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- name: with dashboard configuration
|
|
|
|
when: dashboard_enabled | bool
|
|
|
|
block:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: grafana
|
|
|
|
- import_role:
|
|
|
|
name: ceph-dashboard
|
2019-03-20 20:22:46 +08:00
|
|
|
|
2021-07-09 03:57:13 +08:00
|
|
|
- name: switch any existing crush buckets to straw2
|
|
|
|
hosts: "{{ mon_group_name | default('mons') }}[0]"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: post_upgrade
|
2021-07-09 03:57:13 +08:00
|
|
|
become: true
|
|
|
|
any_errors_fatal: true
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
|
|
|
- name: set_fact ceph_cmd
|
|
|
|
set_fact:
|
|
|
|
ceph_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
|
|
|
|
- name: backup the crushmap
|
|
|
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd getcrushmap -o /etc/ceph/{{ cluster }}-crushmap"
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: switch crush buckets to straw2
|
2021-07-09 15:19:52 +08:00
|
|
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd crush set-all-straw-buckets-to-straw2"
|
2021-07-09 03:57:13 +08:00
|
|
|
changed_when: false
|
|
|
|
rescue:
|
|
|
|
- name: restore the crushmap
|
|
|
|
command: "{{ ceph_cmd }} --cluster {{ cluster }} osd setcrushmap -i /etc/ceph/{{ cluster }}-crushmap"
|
|
|
|
changed_when: false
|
|
|
|
|
2021-07-09 22:29:09 +08:00
|
|
|
- name: inform that the switch to straw2 buckets failed
|
|
|
|
fail:
|
2021-07-09 03:57:13 +08:00
|
|
|
msg: >
|
|
|
|
"An attempt to switch to straw2 bucket was made but failed.
|
|
|
|
Check the cluster status."
|
|
|
|
|
2021-07-09 22:29:09 +08:00
|
|
|
- name: remove crushmap backup
|
|
|
|
file:
|
|
|
|
path: /etc/ceph/{{ cluster }}-crushmap
|
|
|
|
state: absent
|
2021-07-09 03:57:13 +08:00
|
|
|
|
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') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: always
|
2017-10-03 18:25:12 +08:00
|
|
|
become: True
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2017-10-03 18:25:12 +08:00
|
|
|
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:
|
2021-03-03 22:43:50 +08:00
|
|
|
container_exec_cmd_status: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_facts']['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"
|
2020-10-02 18:55:53 +08:00
|
|
|
changed_when: false
|
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] }}"
|
2020-10-02 18:55:53 +08:00
|
|
|
changed_when: false
|