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
|
2014-03-04 02:08:51 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Confirm whether user really meant to upgrade the cluster
|
2016-06-01 00:13:47 +08:00
|
|
|
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:
|
2024-02-14 18:14:02 +08:00
|
|
|
mgr_group_name: mgrs
|
2016-06-01 00:13:47 +08:00
|
|
|
|
|
|
|
vars_prompt:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: ireallymeanit # noqa: name[casing]
|
2016-06-01 00:13:47 +08:00
|
|
|
prompt: Are you sure you want to upgrade the cluster?
|
|
|
|
default: 'no'
|
2024-02-14 18:14:02 +08:00
|
|
|
private: false
|
2016-06-01 00:13:47 +08:00
|
|
|
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Exit playbook, if user did not mean to upgrade cluster
|
|
|
|
ansible.builtin.fail:
|
2017-10-19 00:03:30 +08:00
|
|
|
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'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import_role ceph-defaults
|
|
|
|
ansible.builtin.import_role:
|
2021-03-12 16:26:16 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2016-11-16 16:35:09 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Gather facts and check the init system
|
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') }}"
|
2020-05-01 04:06:55 +08:00
|
|
|
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
2024-06-17 22:35:10 +08:00
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2017-07-29 04:27:02 +08:00
|
|
|
- "{{ client_group_name|default('clients') }}"
|
2020-07-25 06:05:41 +08:00
|
|
|
- "{{ monitoring_group_name|default('monitoring') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: always
|
2024-02-14 18:14:02 +08:00
|
|
|
any_errors_fatal: true
|
|
|
|
become: true
|
|
|
|
gather_facts: false
|
2017-10-19 00:03:30 +08:00
|
|
|
vars:
|
2024-02-14 18:14:02 +08:00
|
|
|
delegate_facts_host: true
|
2015-04-15 03:50:39 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Gather facts on all Ceph hosts for following reference
|
|
|
|
ansible.builtin.debug:
|
|
|
|
msg: "gather facts on all Ceph hosts for following reference"
|
2016-11-06 12:15:26 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-04 17:58:28 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Gather facts
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Gather and delegate facts
|
|
|
|
ansible.builtin.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 }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact rolling_update
|
|
|
|
ansible.builtin.set_fact:
|
2021-10-29 05:40:18 +08:00
|
|
|
rolling_update: true
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-12-05 00:17:36 +08:00
|
|
|
name: ceph-facts
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-infra role
|
|
|
|
ansible.builtin.import_role:
|
2019-12-05 00:17:36 +08:00
|
|
|
name: ceph-infra
|
2022-05-26 03:32:19 +08:00
|
|
|
tags: ceph_infra
|
2019-12-05 00:17:36 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-validate role
|
|
|
|
ansible.builtin.import_role:
|
2020-09-10 23:27:37 +08:00
|
|
|
name: ceph-validate
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
2021-02-04 06:39:49 +08:00
|
|
|
name: ceph-container-engine
|
|
|
|
when:
|
|
|
|
- (group_names != ['clients']) or (inventory_hostname == groups.get('clients', [''])|first)
|
|
|
|
- (containerized_deployment | bool) or (dashboard_enabled | bool)
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.import_role:
|
2020-01-10 03:57:08 +08:00
|
|
|
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
|
|
|
|
|
2024-02-14 18:14:02 +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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get the ceph release being deployed
|
|
|
|
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} --version"
|
2021-07-26 17:19:36 +08:00
|
|
|
register: ceph_version
|
|
|
|
changed_when: false
|
|
|
|
|
2024-03-08 16:03:06 +08:00
|
|
|
- name: Check ceph release being deployed
|
2024-02-14 18:14:02 +08:00
|
|
|
ansible.builtin.fail:
|
2022-10-07 16:49:00 +08:00
|
|
|
msg: "This version of ceph-ansible is intended for upgrading to Ceph Reef only."
|
|
|
|
when: "'reef' not in ceph_version.stdout.split()"
|
2021-07-26 17:19:36 +08:00
|
|
|
|
2016-11-06 12:15:26 +08:00
|
|
|
|
2024-03-14 04:44:41 +08:00
|
|
|
- name: Ensure cluster config is applied
|
|
|
|
hosts: mons[0]
|
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
any_errors_fatal: true
|
|
|
|
tasks:
|
|
|
|
- name: Import default role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
|
|
|
- name: Set cluster configs
|
|
|
|
ceph_config:
|
|
|
|
action: set
|
|
|
|
who: "{{ item.0.key }}"
|
|
|
|
option: "{{ item.1.key }}"
|
|
|
|
value: "{{ item.1.value }}"
|
|
|
|
when: item.1.value != omit
|
|
|
|
loop: "{{ ceph_cluster_conf | dict2dict }}"
|
|
|
|
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 }}"
|
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +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
|
2024-02-14 18:14: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
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2023-06-02 17:34:15 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Upgrade ceph mon cluster
|
2021-03-18 16:08:51 +08:00
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Remove ceph aliases
|
|
|
|
ansible.builtin.file:
|
2021-03-18 16:08:51 +08:00
|
|
|
path: /etc/profile.d/ceph-aliases.sh
|
|
|
|
state: absent
|
|
|
|
when: containerized_deployment | bool
|
2019-03-15 22:18:48 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set mon_host_count
|
|
|
|
ansible.builtin.set_fact:
|
2021-03-18 16:08:51 +08:00
|
|
|
mon_host_count: "{{ groups[mon_group_name] | length }}"
|
2016-11-15 03:04:43 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Fail when less than three monitors
|
|
|
|
ansible.builtin.fail:
|
2021-03-18 16:08:51 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Select a running monitor
|
|
|
|
ansible.builtin.set_fact:
|
2021-03-18 16:08:51 +08:00
|
|
|
mon_host: "{{ groups[mon_group_name] | difference([inventory_hostname]) | last }}"
|
2019-03-25 16:48:48 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-facts
|
2019-06-10 22:26:18 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Check Ceph monitors quorum status
|
|
|
|
when: inventory_hostname == groups[mon_group_name] | first
|
|
|
|
block:
|
|
|
|
- name: Get ceph cluster status
|
|
|
|
ansible.builtin.command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} health -f json"
|
2021-03-18 16:08:51 +08:00
|
|
|
register: check_cluster_health
|
2019-06-10 22:26:18 +08:00
|
|
|
delegate_to: "{{ mon_host }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
changed_when: false
|
2019-06-10 22:26:18 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Display health status before failing
|
|
|
|
when: (check_cluster_health.stdout | from_json).status == 'HEALTH_ERR'
|
|
|
|
block:
|
|
|
|
- name: Display ceph health detail
|
|
|
|
ansible.builtin.command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} health detail"
|
2021-03-18 16:08:51 +08:00
|
|
|
delegate_to: "{{ mon_host }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
changed_when: false
|
2021-03-18 16:08:51 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Fail if cluster isn't in an acceptable state
|
|
|
|
ansible.builtin.fail:
|
2021-03-18 16:08:51 +08:00
|
|
|
msg: "cluster is not in an acceptable state!"
|
2021-07-10 04:09:49 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get the ceph quorum status
|
|
|
|
ansible.builtin.command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} quorum_status -f json"
|
2021-07-10 04:09:49 +08:00
|
|
|
register: check_quorum_status
|
|
|
|
delegate_to: "{{ mon_host }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
changed_when: false
|
2021-07-10 04:09:49 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Fail if the cluster quorum isn't in an acceptable state
|
|
|
|
ansible.builtin.fail:
|
2021-07-10 04:09:49 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Ensure /var/lib/ceph/bootstrap-rbd-mirror is present
|
|
|
|
ansible.builtin.file:
|
2021-03-18 16:08:51 +08:00
|
|
|
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]
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Create potentially missing keys (rbd and rbd-mirror)
|
2021-03-18 16:08:51 +08:00
|
|
|
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
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop ceph mon
|
|
|
|
ansible.builtin.systemd:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-mon@{{ item }}
|
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: true
|
2021-03-18 16:08:51 +08:00
|
|
|
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
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Mask the mgr service
|
|
|
|
ansible.builtin.systemd:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
2024-02-14 18:14:02 +08:00
|
|
|
masked: true
|
2021-03-18 16:08:51 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-common
|
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.import_role:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-container-common
|
|
|
|
when: containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-config
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-mon role
|
|
|
|
ansible.builtin.import_role:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-mon
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Start ceph mgr
|
|
|
|
ansible.builtin.systemd:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
|
|
|
state: started
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: true
|
|
|
|
masked: false
|
2021-03-18 16:08:51 +08:00
|
|
|
when: inventory_hostname in groups[mgr_group_name] | default([])
|
|
|
|
or groups[mgr_group_name] | default([]) | length == 0
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import_role ceph-facts
|
|
|
|
ansible.builtin.import_role:
|
2021-10-28 22:17:24 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: set_monitor_address.yml
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
delegate_facts: true
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Non container | waiting for the monitor to join the quorum...
|
2024-02-16 21:20:22 +08:00
|
|
|
ansible.builtin.command: ceph --cluster "{{ cluster }}" -m "{{ _monitor_addresses[groups['mons'][0]] }}" quorum_status --format json
|
2021-03-18 16:08:51 +08:00
|
|
|
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 }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
changed_when: false
|
2021-03-18 16:08:51 +08:00
|
|
|
when: not containerized_deployment | bool
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Container | waiting for the containerized monitor to join the quorum...
|
|
|
|
ansible.builtin.command: >
|
2024-02-16 21:20:22 +08:00
|
|
|
{{ container_binary }} exec ceph-mon-{{ ansible_facts['hostname'] }} ceph --cluster "{{ cluster }}" -m "{{ _monitor_addresses[groups['mons'][0]] }}" quorum_status --format json
|
2021-03-18 16:08:51 +08:00
|
|
|
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 }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
changed_when: false
|
2021-03-18 16:08:51 +08:00
|
|
|
when: containerized_deployment | bool
|
|
|
|
rescue:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2023-06-02 17:34:15 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Unmask the mon service
|
|
|
|
ansible.builtin.systemd:
|
2021-03-26 23:12:42 +08:00
|
|
|
name: ceph-mon@{{ ansible_facts['hostname'] }}
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: true
|
|
|
|
masked: false
|
2021-03-18 16:08:51 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Unmask the mgr service
|
|
|
|
ansible.builtin.systemd:
|
2021-03-18 16:08:51 +08:00
|
|
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
2024-02-14 18:14:02 +08:00
|
|
|
masked: false
|
2021-03-18 16:08:51 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop the playbook execution
|
|
|
|
ansible.builtin.fail:
|
2021-03-26 23:12:42 +08:00
|
|
|
msg: "There was an error during monitor upgrade. Please, check the previous task results."
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Reset mon_host
|
2019-09-27 22:24:58 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}"
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: always
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-09-27 22:24:58 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-09-27 22:24:58 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Reset mon_host fact
|
|
|
|
ansible.builtin.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
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade ceph mgr nodes when implicitly collocated on monitors
|
2019-03-20 18:44:11 +08:00
|
|
|
vars:
|
|
|
|
health_mon_check_retries: 5
|
|
|
|
health_mon_check_delay: 15
|
2024-02-14 18:14:02 +08:00
|
|
|
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
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-03-20 18:44:11 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- 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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop ceph mgr
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
masked: true
|
2019-03-20 18:44:11 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 18:44:11 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 18:44:11 +08:00
|
|
|
name: ceph-facts
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 18:44:11 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 18:44:11 +08:00
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 18:44:11 +08:00
|
|
|
name: ceph-container-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 18:44:11 +08:00
|
|
|
name: ceph-config
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-mgr role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 18:44:11 +08:00
|
|
|
name: ceph-mgr
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade ceph mgr nodes
|
2017-10-16 20:15:43 +08:00
|
|
|
vars:
|
2024-02-14 18:14:02 +08:00
|
|
|
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
|
2024-02-14 18:14:02 +08:00
|
|
|
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
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop ceph mgr
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: false
|
2023-01-22 15:21:31 +08:00
|
|
|
failed_when: false
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Mask ceph mgr systemd unit
|
|
|
|
ansible.builtin.systemd:
|
2023-01-22 15:21:31 +08:00
|
|
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
2024-02-14 18:14:02 +08:00
|
|
|
masked: true
|
2017-10-16 20:15:43 +08:00
|
|
|
failed_when: false
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2018-12-10 22:46:32 +08:00
|
|
|
name: ceph-facts
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-config
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-mgr role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-mgr
|
2017-10-16 20:15:43 +08:00
|
|
|
|
2017-05-12 21:59:52 +08:00
|
|
|
|
2024-02-14 18:14:02 +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
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-11-19 00:59:56 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults
|
|
|
|
ansible.builtin.import_role:
|
2019-11-19 00:59:56 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-11-19 00:59:56 +08:00
|
|
|
name: ceph-facts
|
2020-04-03 21:07:54 +08:00
|
|
|
tasks_from: container_binary.yml
|
2019-11-19 00:59:56 +08:00
|
|
|
|
2024-02-14 18:14:02 +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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get pool list
|
|
|
|
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
|
2021-10-25 19:43:25 +08:00
|
|
|
register: pool_list
|
|
|
|
changed_when: false
|
|
|
|
check_mode: false
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get balancer module status
|
|
|
|
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json"
|
2021-10-25 19:43:25 +08:00
|
|
|
register: balancer_status_update
|
|
|
|
run_once: true
|
|
|
|
changed_when: false
|
|
|
|
check_mode: false
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact pools_pgautoscaler_mode
|
|
|
|
ansible.builtin.set_fact:
|
2021-10-25 19:43:25 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Disable balancer
|
|
|
|
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"
|
2021-10-25 19:43:25 +08:00
|
|
|
changed_when: false
|
|
|
|
when: (balancer_status_update.stdout | from_json)['active'] | bool
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Disable pg autoscale on pools
|
2021-10-25 19:43:25 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set osd flags
|
2021-10-25 19:43:25 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade ceph osds cluster
|
2017-05-12 21:59:52 +08:00
|
|
|
vars:
|
2021-10-25 20:28:41 +08:00
|
|
|
health_osd_check_retries: 600
|
|
|
|
health_osd_check_delay: 2
|
2024-02-14 18:14:02 +08:00
|
|
|
upgrade_ceph_packages: true
|
|
|
|
hosts: osds
|
2021-10-20 16:01:05 +08:00
|
|
|
tags: osds
|
2017-05-12 21:59:52 +08:00
|
|
|
serial: 1
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-06-18 16:08:48 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-06-18 16:08:48 +08:00
|
|
|
name: ceph-facts
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get osd numbers - non container
|
|
|
|
ansible.builtin.shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi # noqa: risky-shell-pipe
|
2016-11-15 04:25:46 +08:00
|
|
|
register: osd_ids
|
|
|
|
changed_when: false
|
2018-08-13 21:59:25 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set num_osds
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
num_osds: "{{ osd_ids.stdout_lines | default([]) | length }}"
|
2019-03-29 03:34:48 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact container_exec_cmd_osd
|
|
|
|
ansible.builtin.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
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop ceph osd
|
|
|
|
ansible.builtin.systemd:
|
2017-10-16 20:15:43 +08:00
|
|
|
name: ceph-osd@{{ item }}
|
2016-11-15 04:25:46 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: true
|
2016-11-15 04:25:46 +08:00
|
|
|
with_items: "{{ osd_ids.stdout_lines }}"
|
2019-03-29 03:34:48 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-config
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-osd role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-osd
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2024-02-14 18:14:02 +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
|
|
|
|
2024-02-14 18:14:02 +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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Waiting for clean pgs...
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-14 18:14:02 +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
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2017-05-12 21:59:52 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2018-12-10 22:46:32 +08:00
|
|
|
name: ceph-facts
|
2020-04-03 21:07:54 +08:00
|
|
|
tasks_from: container_binary.yml
|
2018-10-01 23:43:24 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Unset osd flags, re-enable pg autoscaler and balancer
|
2021-10-25 19:43:25 +08:00
|
|
|
run_once: true
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Re-enable pg autoscale on pools
|
2021-10-25 19:43:25 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Unset osd flags
|
2021-10-25 19:43:25 +08:00
|
|
|
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
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Re-enable balancer
|
|
|
|
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
|
2021-10-25 19:43:25 +08:00
|
|
|
changed_when: false
|
|
|
|
when: (balancer_status_update.stdout | from_json)['active'] | bool
|
2021-06-15 00:01:41 +08:00
|
|
|
|
2024-02-14 18:14:02 +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:
|
2024-02-14 18:14:02 +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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-23 21:48:32 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-23 21:48:32 +08:00
|
|
|
name: ceph-facts
|
2019-10-17 20:43:18 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Deactivate all mds rank > 0 if any
|
2019-10-24 01:39:15 +08:00
|
|
|
when: groups.get(mds_group_name, []) | length > 1
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- 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
|
|
|
|
2024-02-14 18:14:02 +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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get name of remaining active mds
|
|
|
|
ansible.builtin.command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs dump -f json"
|
2019-10-24 01:39:15 +08:00
|
|
|
changed_when: false
|
|
|
|
register: _mds_active_name
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact mds_active_name
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact mds_active_host
|
|
|
|
ansible.builtin.set_fact:
|
2019-10-26 04:47:50 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Create standby_mdss group
|
|
|
|
ansible.builtin.add_host:
|
2019-10-24 01:39:15 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop standby ceph mds
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2019-10-24 01:39:15 +08:00
|
|
|
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
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Mask systemd units for standby ceph mds
|
|
|
|
ansible.builtin.systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: "ceph-mds@{{ hostvars[item]['ansible_facts']['hostname'] }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
masked: true
|
2019-10-24 01:39:15 +08:00
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
with_items: "{{ groups['standby_mdss'] }}"
|
|
|
|
when: groups['standby_mdss'] | default([]) | length > 0
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Wait until all standbys mds are stopped
|
|
|
|
ansible.builtin.command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs dump -f json"
|
2019-10-24 01:39:15 +08:00
|
|
|
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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Create active_mdss group
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade active mds
|
2019-10-11 01:09:49 +08:00
|
|
|
vars:
|
2024-02-14 18:14:02 +08:00
|
|
|
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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-defaults
|
2019-10-11 01:09:49 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2018-12-10 22:46:32 +08:00
|
|
|
name: ceph-facts
|
2019-10-11 01:09:49 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Prevent restart from the packaging
|
|
|
|
ansible.builtin.systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-mds@{{ ansible_facts['hostname'] }}
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: true
|
2020-07-29 21:44:15 +08:00
|
|
|
when: not containerized_deployment | bool
|
2019-10-11 01:09:49 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-config
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-mds role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-mds
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Restart ceph mds
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: true
|
|
|
|
masked: false
|
2020-07-29 21:44:15 +08:00
|
|
|
when: not containerized_deployment | bool
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Restart active mds
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade standbys ceph mdss cluster
|
2019-10-11 01:09:49 +08:00
|
|
|
vars:
|
2024-02-14 18:14:02 +08:00
|
|
|
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
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-10-11 01:09:49 +08:00
|
|
|
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-11 01:09:49 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-11 01:09:49 +08:00
|
|
|
name: ceph-facts
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Prevent restarts from the packaging
|
|
|
|
ansible.builtin.systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-mds@{{ ansible_facts['hostname'] }}
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: true
|
2020-07-29 21:44:15 +08:00
|
|
|
when: not containerized_deployment | bool
|
2016-11-16 16:35:09 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-11 01:09:49 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-11 01:09:49 +08:00
|
|
|
name: ceph-common
|
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-11 01:09:49 +08:00
|
|
|
name: ceph-container-common
|
|
|
|
when: containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-11 01:09:49 +08:00
|
|
|
name: ceph-config
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-mds role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-11 01:09:49 +08:00
|
|
|
name: ceph-mds
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- 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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade ceph rgws cluster
|
2016-01-29 23:54:59 +08:00
|
|
|
vars:
|
2024-02-14 18:14: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
|
2024-02-14 18:14:02 +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-03-25 21:50:09 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-25 21:50:09 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-25 21:50:09 +08:00
|
|
|
name: ceph-facts
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop ceph rgw when upgrading from stable-3.2 # noqa: ignore-errors
|
|
|
|
ansible.builtin.systemd:
|
2024-05-08 02:41:53 +08:00
|
|
|
name: ceph-radosgw@rgw.{{ rgw_zone }}.{{ ansible_facts['hostname'] }}
|
2016-11-15 04:44:55 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: true
|
|
|
|
ignore_errors: true
|
2019-03-25 21:50:09 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop ceph rgw
|
|
|
|
ansible.builtin.systemd:
|
2024-05-08 02:41:53 +08:00
|
|
|
name: ceph-radosgw@rgw.{{ rgw_zone }}.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}
|
2019-03-25 21:50:09 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: true
|
2019-03-25 21:50:09 +08:00
|
|
|
with_items: "{{ rgw_instances }}"
|
2016-11-15 04:44:55 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-config
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-rgw role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-rgw
|
2015-03-27 01:51:11 +08:00
|
|
|
|
2017-07-29 04:27:02 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade ceph rbd mirror node
|
2017-07-29 04:27:02 +08:00
|
|
|
vars:
|
2024-02-14 18:14:02 +08:00
|
|
|
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
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Check for ceph rbd mirror services
|
|
|
|
ansible.builtin.command: systemctl show --no-pager --property=Id --state=enabled ceph-rbd-mirror@* # noqa command-instead-of-module
|
2022-08-03 15:09:15 +08:00
|
|
|
changed_when: false
|
|
|
|
register: rbdmirror_services
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop ceph rbd mirror
|
|
|
|
ansible.builtin.service:
|
2022-08-03 15:09:15 +08:00
|
|
|
name: "{{ item.split('=')[1] }}"
|
2017-10-16 20:15:43 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: true
|
2022-08-03 15:09:15 +08:00
|
|
|
loop: "{{ rbdmirror_services.stdout_lines }}"
|
2017-10-16 20:15:43 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2018-12-10 22:46:32 +08:00
|
|
|
name: ceph-facts
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.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
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-config
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-rbd-mirror role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-rbd-mirror
|
2017-10-03 18:25:12 +08:00
|
|
|
|
2017-10-16 20:15:43 +08:00
|
|
|
|
2024-06-17 22:35:10 +08:00
|
|
|
- name: Upgrade ceph nfs node
|
|
|
|
vars:
|
|
|
|
upgrade_ceph_packages: true
|
|
|
|
hosts: "{{ nfs_group_name|default('nfss') }}"
|
|
|
|
tags: nfss
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
|
|
# 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
|
|
|
|
- name: Stop ceph nfs
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: nfs-ganesha
|
|
|
|
state: stopped
|
|
|
|
enabled: false
|
|
|
|
masked: true
|
|
|
|
failed_when: false
|
|
|
|
when: not containerized_deployment | bool
|
|
|
|
|
|
|
|
- name: Systemd stop nfs container
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_facts['hostname']) }}
|
|
|
|
state: stopped
|
|
|
|
enabled: false
|
|
|
|
masked: true
|
|
|
|
failed_when: false
|
|
|
|
when:
|
|
|
|
- ceph_nfs_enable_service | bool
|
|
|
|
- containerized_deployment | bool
|
|
|
|
|
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-common
|
|
|
|
when: not containerized_deployment | bool
|
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-container-common
|
|
|
|
when: containerized_deployment | bool
|
|
|
|
|
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-config
|
|
|
|
|
|
|
|
- name: Import ceph-nfs role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-nfs
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade ceph client node
|
2017-10-16 20:15:43 +08:00
|
|
|
vars:
|
2024-02-14 18:14:02 +08:00
|
|
|
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) }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2018-12-10 22:46:32 +08:00
|
|
|
name: ceph-facts
|
2021-11-09 22:35:12 +08:00
|
|
|
tasks_from: container_binary.yml
|
|
|
|
when: containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-common role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-common
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade ceph-crash daemons
|
2020-07-03 16:21:49 +08:00
|
|
|
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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop the ceph-crash service
|
|
|
|
ansible.builtin.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.
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Mask and disable the ceph-crash service
|
|
|
|
ansible.builtin.systemd:
|
2021-05-04 17:42:15 +08:00
|
|
|
name: "{{ 'ceph-crash@' + ansible_facts['hostname'] if containerized_deployment | bool else 'ceph-crash.service' }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
|
|
|
masked: true
|
2021-05-04 17:42:15 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-03 16:21:49 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-03 16:21:49 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-03 16:21:49 +08:00
|
|
|
name: ceph-handler
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-crash role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-03 16:21:49 +08:00
|
|
|
name: ceph-crash
|
|
|
|
|
2024-03-04 09:03:19 +08:00
|
|
|
- name: Upgrade ceph-exporter 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') }}"
|
|
|
|
tags:
|
|
|
|
- post_upgrade
|
|
|
|
- ceph-exporter
|
|
|
|
gather_facts: false
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- name: Exit ceph-exporter upgrade if non containerized deployment
|
|
|
|
ansible.builtin.meta: end_play
|
|
|
|
when: not containerized_deployment | bool
|
|
|
|
|
2024-03-12 07:38:19 +08:00
|
|
|
- name: Stop the ceph-exporter service # noqa: ignore-errors
|
2024-03-04 09:03:19 +08:00
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: "{{ 'ceph-exporter@' + ansible_facts['hostname'] if containerized_deployment | bool else 'ceph-exporter.service' }}"
|
|
|
|
state: stopped
|
2024-02-20 05:39:47 +08:00
|
|
|
ignore_errors: true
|
2024-03-04 09:03:19 +08:00
|
|
|
|
|
|
|
# it needs to be done in a separate task otherwise the stop just before doesn't work.
|
2024-03-12 07:38:19 +08:00
|
|
|
- name: Mask and disable the ceph-exporter service # noqa: ignore-errors
|
2024-03-04 09:03:19 +08:00
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: "{{ 'ceph-exporter@' + ansible_facts['hostname'] if containerized_deployment | bool else 'ceph-exporter.service' }}"
|
|
|
|
enabled: false
|
|
|
|
masked: true
|
2024-02-20 05:39:47 +08:00
|
|
|
ignore_errors: true
|
2024-03-04 09:03:19 +08:00
|
|
|
|
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
- name: Import ceph-exporter role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-exporter
|
|
|
|
|
2024-02-14 18:14:02 +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
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2019-03-20 20:25:26 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 20:25:26 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-03-20 20:25:26 +08:00
|
|
|
name: ceph-facts
|
2020-09-25 22:20:35 +08:00
|
|
|
tasks_from: container_binary.yml
|
2019-03-20 20:25:26 +08:00
|
|
|
|
2024-03-08 16:03:06 +08:00
|
|
|
- name: Container | disallow pre-reef OSDs and enable all new reef-only functionality
|
2024-02-14 18:14:02 +08:00
|
|
|
ansible.builtin.command: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_facts']['hostname'] }} ceph --cluster {{ cluster }} osd require-osd-release reef"
|
2019-03-20 20:25:26 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
run_once: true
|
|
|
|
changed_when: false
|
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
|
|
|
|
2024-03-08 16:03:06 +08:00
|
|
|
- name: Non container | disallow pre-reef OSDs and enable all new reef-only functionality
|
2024-02-14 18:14:02 +08:00
|
|
|
ansible.builtin.command: "ceph --cluster {{ cluster }} osd require-osd-release reef"
|
2019-03-20 20:25:26 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
run_once: true
|
|
|
|
changed_when: false
|
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
|
|
|
|
2024-02-14 18:14:02 +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') }}"
|
2024-06-17 22:35:10 +08:00
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2021-02-04 02:07:24 +08:00
|
|
|
- "{{ 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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: With dashboard configuration
|
2020-07-24 23:21:54 +08:00
|
|
|
when: dashboard_enabled | bool
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop node-exporter
|
|
|
|
ansible.builtin.service:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: node_exporter
|
|
|
|
state: stopped
|
|
|
|
failed_when: false
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-facts
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-container-engine
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-container-common
|
|
|
|
tasks_from: registry
|
|
|
|
when:
|
|
|
|
- not containerized_deployment | bool
|
|
|
|
- ceph_docker_registry_auth | bool
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-node-exporter role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-node-exporter
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade monitoring node
|
2023-06-02 17:34:15 +08:00
|
|
|
hosts: "{{ 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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: With dashboard configuration
|
2020-07-24 23:21:54 +08:00
|
|
|
when: dashboard_enabled | bool
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop monitoring services
|
|
|
|
ansible.builtin.service:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: '{{ item }}'
|
|
|
|
state: stopped
|
|
|
|
failed_when: false
|
|
|
|
with_items:
|
|
|
|
- alertmanager
|
|
|
|
- prometheus
|
|
|
|
- grafana-server
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
# - name: Import ceph-facts role
|
|
|
|
# ansible.builtin.import_role:
|
|
|
|
# name: ceph-facts
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: grafana
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-prometheus role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-prometheus
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-grafana role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-grafana
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Upgrade ceph dashboard
|
2023-06-02 17:34:15 +08:00
|
|
|
hosts: "{{ groups[mgr_group_name|default('mgrs')] | default(groups[mon_group_name|default('mons')]) | 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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: With dashboard configuration
|
2020-07-24 23:21:54 +08:00
|
|
|
when: dashboard_enabled | bool
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-facts
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: grafana
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-dashboard role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-24 23:21:54 +08:00
|
|
|
name: ceph-dashboard
|
2019-03-20 20:22:46 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Switch any existing crush buckets to straw2
|
2021-07-09 03:57:13 +08:00
|
|
|
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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2021-07-09 03:57:13 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2021-07-09 03:57:13 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact ceph_cmd
|
|
|
|
ansible.builtin.set_fact:
|
2021-07-09 03:57:13 +08:00
|
|
|
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' }}"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Backup the crushmap
|
|
|
|
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} osd getcrushmap -o /etc/ceph/{{ cluster }}-crushmap"
|
2021-07-09 03:57:13 +08:00
|
|
|
changed_when: false
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Migrate crush buckets to straw2
|
|
|
|
block:
|
|
|
|
- name: Switch crush buckets to straw2
|
|
|
|
ansible.builtin.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:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Restore the crushmap
|
|
|
|
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} osd setcrushmap -i /etc/ceph/{{ cluster }}-crushmap"
|
2021-07-09 03:57:13 +08:00
|
|
|
changed_when: false
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Inform that the switch to straw2 buckets failed
|
|
|
|
ansible.builtin.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."
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Remove crushmap backup
|
|
|
|
ansible.builtin.file:
|
2021-07-09 22:29:09 +08:00
|
|
|
path: /etc/ceph/{{ cluster }}-crushmap
|
|
|
|
state: absent
|
2021-07-09 03:57:13 +08:00
|
|
|
|
2024-02-14 18:14:02 +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
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2021-05-14 22:24:55 +08:00
|
|
|
gather_facts: false
|
2017-10-03 18:25:12 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-defaults
|
2018-11-20 00:13:37 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact container_exec_cmd_status
|
|
|
|
ansible.builtin.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
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Show ceph status
|
|
|
|
ansible.builtin.command: "{{ container_exec_cmd_status | default('') }} ceph --cluster {{ cluster }} -s"
|
2020-10-02 18:55:53 +08:00
|
|
|
changed_when: false
|
2024-02-14 18:14:02 +08:00
|
|
|
run_once: true
|
2019-03-21 02:11:32 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Show all daemons version
|
|
|
|
ansible.builtin.command: "{{ container_exec_cmd_status | default('') }} ceph --cluster {{ cluster }} versions"
|
|
|
|
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
|