2016-09-14 23:53:30 +08:00
|
|
|
---
|
|
|
|
# This playbook switches from non-containerized to containerized Ceph daemons
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Confirm whether user really meant to switch from non-containerized to containerized ceph daemons
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: localhost
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
gather_facts: false
|
2022-02-22 00:12:06 +08:00
|
|
|
any_errors_fatal: true
|
2016-09-14 23:53:30 +08:00
|
|
|
vars_prompt:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: ireallymeanit # noqa: name[casing]
|
2016-09-14 23:53:30 +08:00
|
|
|
prompt: Are you sure you want to switch from non-containerized to containerized ceph daemons?
|
|
|
|
default: 'no'
|
2024-02-14 18:14:02 +08:00
|
|
|
private: false
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2022-02-22 00:12:06 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Fail when less than three monitors
|
|
|
|
ansible.builtin.fail:
|
2022-02-22 00:12:06 +08:00
|
|
|
msg: "This playbook requires at least three monitors."
|
|
|
|
when: groups[mon_group_name] | length | int < 3
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Exit playbook, if user did not mean to switch from non-containerized to containerized daemons?
|
|
|
|
ansible.builtin.fail:
|
2017-08-22 22:43:01 +08:00
|
|
|
msg: >
|
|
|
|
"Exiting switch-from-non-containerized-to-containerized-ceph-daemons.yml playbook,
|
|
|
|
cluster did not switch from non-containerized to containerized ceph daemons.
|
|
|
|
To switch from non-containerized to containerized ceph daemons, either say 'yes' on the prompt or
|
|
|
|
or use `-e ireallymeanit=yes` on the command line when
|
|
|
|
invoking the playbook"
|
|
|
|
when: ireallymeanit != 'yes'
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Gather facts
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
hosts:
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
2017-09-05 21:18:01 +08:00
|
|
|
- "{{ mgr_group_name|default('mgrs') }}"
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
|
|
|
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
2024-06-17 22:35:10 +08:00
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
become: true
|
|
|
|
|
2019-12-09 21:20:42 +08:00
|
|
|
vars:
|
2024-02-14 18:14:02 +08:00
|
|
|
delegate_facts_host: true
|
2019-12-09 21:20:42 +08:00
|
|
|
|
2016-09-14 23:53:30 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-12-09 21:20:42 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
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-08-25 20:36:07 +08:00
|
|
|
delegate_to: "{{ item }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
delegate_facts: true
|
2019-12-09 21:20:42 +08:00
|
|
|
with_items: "{{ groups['all'] | difference(groups.get(client_group_name, [])) }}"
|
|
|
|
run_once: true
|
|
|
|
when: delegate_facts_host | bool
|
|
|
|
tags: always
|
2017-08-25 20:36:07 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2021-06-28 22:46:40 +08:00
|
|
|
name: ceph-facts
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-validate role
|
|
|
|
ansible.builtin.import_role:
|
2021-06-28 22:46:40 +08:00
|
|
|
name: ceph-validate
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph mon
|
2016-09-14 23:53:30 +08:00
|
|
|
vars:
|
2017-08-22 22:43:01 +08:00
|
|
|
containerized_deployment: true
|
2024-02-14 18:14:02 +08:00
|
|
|
switch_to_containers: true
|
|
|
|
mon_group_name: mons
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
serial: 1
|
|
|
|
become: true
|
2018-11-12 20:21:26 +08:00
|
|
|
pre_tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Select a running monitor
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
mon_host: "{{ item }}"
|
2017-08-22 22:43:01 +08:00
|
|
|
with_items: "{{ groups[mon_group_name] }}"
|
|
|
|
when: item != inventory_hostname
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop non-containerized ceph mon
|
|
|
|
ansible.builtin.service:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: "ceph-mon@{{ ansible_facts['hostname'] }}"
|
2017-08-22 22:43:01 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Remove old systemd unit files
|
|
|
|
ansible.builtin.file:
|
2020-09-15 21:46:30 +08:00
|
|
|
path: "{{ item }}"
|
2019-02-12 17:56:28 +08:00
|
|
|
state: absent
|
|
|
|
with_items:
|
2020-09-15 21:46:30 +08:00
|
|
|
- /usr/lib/systemd/system/ceph-mon@.service
|
|
|
|
- /usr/lib/systemd/system/ceph-mon.target
|
|
|
|
- /lib/systemd/system/ceph-mon@.service
|
|
|
|
- /lib/systemd/system/ceph-mon.target
|
2019-02-12 17:56:28 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-defaults
|
2018-04-19 16:28:56 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-facts
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2019-10-07 15:19:50 +08:00
|
|
|
# NOTE: changed from file module to raw find command for performance reasons
|
2019-08-11 03:44:32 +08:00
|
|
|
# The file module has to run checks on current ownership of all directories and files. This is unnecessary
|
|
|
|
# as in this case we know we want all owned by ceph user
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set proper ownership on ceph directories
|
|
|
|
ansible.builtin.command: "find /var/lib/ceph/mon /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown -h {{ ceph_uid }}:{{ ceph_uid }} {} +"
|
2019-08-11 03:44:32 +08:00
|
|
|
changed_when: false
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Check for existing old leveldb file extension (ldb)
|
|
|
|
ansible.builtin.shell: stat /var/lib/ceph/mon/*/store.db/*.ldb
|
2017-08-22 22:43:01 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: ldb_files
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Rename leveldb extension from ldb to sst
|
|
|
|
ansible.builtin.shell: rename -v .ldb .sst /var/lib/ceph/mon/*/store.db/*.ldb
|
2017-08-22 22:43:01 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
when: ldb_files.rc == 0
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Copy mon initial keyring in /etc/ceph to satisfy fetch config task in ceph-container-common
|
|
|
|
ansible.builtin.command: cp /var/lib/ceph/mon/{{ cluster }}-{{ ansible_facts['hostname'] }}/keyring /etc/ceph/{{ cluster }}.mon.keyring
|
2018-10-03 19:39:35 +08:00
|
|
|
args:
|
|
|
|
creates: /etc/ceph/{{ cluster }}.mon.keyring
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
tasks:
|
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
|
2018-12-10 22:46:32 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
2019-05-20 15:46:10 +08:00
|
|
|
name: ceph-container-engine
|
|
|
|
|
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
|
2018-12-10 22:46:32 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-mon role
|
|
|
|
ansible.builtin.import_role:
|
2018-10-01 23:43:24 +08:00
|
|
|
name: ceph-mon
|
|
|
|
|
2018-10-19 23:07:55 +08:00
|
|
|
post_tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Waiting for the monitor to join the quorum...
|
|
|
|
ansible.builtin.command: "{{ container_binary }} run --rm -v /etc/ceph:/etc/ceph:z --entrypoint=ceph {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --cluster {{ cluster }} quorum_status --format json"
|
2017-10-16 20:27:57 +08:00
|
|
|
register: ceph_health_raw
|
2021-03-03 22:43:50 +08:00
|
|
|
until: ansible_facts['hostname'] in (ceph_health_raw.stdout | trim | from_json)["quorum_names"]
|
2020-10-02 18:55:53 +08:00
|
|
|
changed_when: false
|
2017-08-22 22:43:01 +08:00
|
|
|
retries: "{{ health_mon_check_retries }}"
|
|
|
|
delay: "{{ health_mon_check_delay }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph mgr
|
2017-09-05 21:18:01 +08:00
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mgr_group_name|default('mgrs') }}"
|
2017-09-05 21:18:01 +08:00
|
|
|
|
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
mgr_group_name: mgrs
|
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
2018-11-12 20:21:26 +08:00
|
|
|
pre_tasks:
|
2018-01-06 02:37:36 +08:00
|
|
|
# failed_when: false is here because if we're
|
|
|
|
# working with a jewel cluster then ceph mgr
|
|
|
|
# will not exist
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop non-containerized ceph mgr(s)
|
|
|
|
ansible.builtin.service:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: "ceph-mgr@{{ ansible_facts['hostname'] }}"
|
2017-09-05 21:18:01 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2018-01-06 02:37:36 +08:00
|
|
|
failed_when: false
|
2017-09-05 21:18:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Remove old systemd unit files
|
|
|
|
ansible.builtin.file:
|
2020-09-15 21:46:30 +08:00
|
|
|
path: "{{ item }}"
|
2019-02-12 17:56:28 +08:00
|
|
|
state: absent
|
|
|
|
with_items:
|
2020-09-15 21:46:30 +08:00
|
|
|
- /usr/lib/systemd/system/ceph-mgr@.service
|
|
|
|
- /usr/lib/systemd/system/ceph-mgr.target
|
|
|
|
- /lib/systemd/system/ceph-mgr@.service
|
|
|
|
- /lib/systemd/system/ceph-mgr.target
|
2019-02-12 17:56:28 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-defaults
|
2017-09-05 21:18:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-facts
|
2017-09-05 21:18:01 +08:00
|
|
|
|
2019-10-07 15:19:50 +08:00
|
|
|
# NOTE: changed from file module to raw find command for performance reasons
|
2019-08-11 03:44:32 +08:00
|
|
|
# The file module has to run checks on current ownership of all directories and files. This is unnecessary
|
|
|
|
# as in this case we know we want all owned by ceph user
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set proper ownership on ceph directories
|
|
|
|
ansible.builtin.command: "find /var/lib/ceph/mgr /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown -h {{ ceph_uid }}:{{ ceph_uid }} {} +"
|
2019-08-11 03:44:32 +08:00
|
|
|
changed_when: false
|
2017-09-05 21:18:01 +08:00
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
tasks:
|
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-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
2019-05-20 15:46:10 +08:00
|
|
|
name: ceph-container-engine
|
|
|
|
|
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
|
2018-10-01 23:43:24 +08:00
|
|
|
|
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-09-05 21:18:01 +08:00
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set osd flags
|
2020-04-03 21:36:23 +08:00
|
|
|
hosts: "{{ mon_group_name | default('mons') }}[0]"
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2020-04-03 21:36:23 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-04-03 21:36:23 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-04-03 21:36:23 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
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-06-15 00:01:41 +08:00
|
|
|
register: pool_list
|
|
|
|
changed_when: false
|
2021-07-26 23:10:19 +08:00
|
|
|
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-08-03 23:58:49 +08:00
|
|
|
register: balancer_status_switch
|
2021-06-15 00:01:41 +08:00
|
|
|
changed_when: false
|
2021-07-26 23:10:19 +08:00
|
|
|
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-06-15 00:01:41 +08:00
|
|
|
pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
|
2021-07-29 02:54:15 +08:00
|
|
|
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-06-15 00:01:41 +08:00
|
|
|
changed_when: false
|
2021-08-03 23:58:49 +08:00
|
|
|
when: (balancer_status_switch.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-06-15 00:01:41 +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 }}"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set osd flags
|
2020-11-04 05:44:58 +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 }}"
|
2020-04-03 21:36:23 +08:00
|
|
|
with_items:
|
|
|
|
- noout
|
|
|
|
- nodeep-scrub
|
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph osd
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
vars:
|
2017-08-22 22:43:01 +08:00
|
|
|
containerized_deployment: true
|
2016-09-14 23:53:30 +08:00
|
|
|
osd_group_name: osds
|
2024-02-14 18:14:02 +08:00
|
|
|
switch_to_containers: true
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ osd_group_name|default('osds') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
2018-11-12 20:21:26 +08:00
|
|
|
pre_tasks:
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2018-11-20 00:13:37 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Collect running osds
|
|
|
|
ansible.builtin.shell: |
|
2020-10-02 17:23:42 +08:00
|
|
|
set -o pipefail;
|
2020-11-26 17:11:36 +08:00
|
|
|
systemctl list-units | grep -E "loaded * active" | grep -Eo 'ceph-osd@[0-9]+.service|ceph-volume'
|
2019-04-12 04:20:41 +08:00
|
|
|
register: running_osds
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
|
2020-10-20 05:22:31 +08:00
|
|
|
# systemd module does not support --runtime option
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Disable ceph-osd@.service runtime-enabled
|
|
|
|
ansible.builtin.command: "systemctl disable --runtime {{ item }}" # noqa command-instead-of-module
|
2020-10-20 05:22:31 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2020-10-02 19:05:01 +08:00
|
|
|
with_items: "{{ running_osds.stdout_lines | default([]) }}"
|
2020-10-20 05:22:31 +08:00
|
|
|
when: item.startswith('ceph-osd@')
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop/disable/mask non-containerized ceph osd(s) (if any)
|
|
|
|
ansible.builtin.systemd:
|
2019-04-12 04:20:41 +08:00
|
|
|
name: "{{ item }}"
|
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2020-10-02 19:05:01 +08:00
|
|
|
with_items: "{{ running_osds.stdout_lines | default([]) }}"
|
2019-04-12 04:20:41 +08:00
|
|
|
when: running_osds != []
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Disable ceph.target
|
|
|
|
ansible.builtin.systemd:
|
2020-11-26 17:11:36 +08:00
|
|
|
name: ceph.target
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2020-11-26 17:11:36 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Remove old ceph-osd systemd units
|
|
|
|
ansible.builtin.file:
|
2018-11-16 23:15:24 +08:00
|
|
|
path: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- /usr/lib/systemd/system/ceph-osd.target
|
|
|
|
- /usr/lib/systemd/system/ceph-osd@.service
|
|
|
|
- /usr/lib/systemd/system/ceph-volume@.service
|
2020-09-15 21:46:30 +08:00
|
|
|
- /lib/systemd/system/ceph-osd.target
|
|
|
|
- /lib/systemd/system/ceph-osd@.service
|
|
|
|
- /lib/systemd/system/ceph-volume@.service
|
2018-11-16 23:15:24 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-facts
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2019-10-07 15:19:50 +08:00
|
|
|
# NOTE: changed from file module to raw find command for performance reasons
|
2019-08-11 03:44:32 +08:00
|
|
|
# The file module has to run checks on current ownership of all directories and files. This is unnecessary
|
|
|
|
# as in this case we know we want all owned by ceph user
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set proper ownership on ceph directories
|
|
|
|
ansible.builtin.command: "find /var/lib/ceph/osd /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown -h {{ ceph_uid }}:{{ ceph_uid }} {} +"
|
2019-08-11 03:44:32 +08:00
|
|
|
changed_when: false
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Check for existing old leveldb file extension (ldb)
|
|
|
|
ansible.builtin.shell: stat /var/lib/ceph/osd/*/current/omap/*.ldb
|
2017-08-22 22:43:01 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: ldb_files
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Rename leveldb extension from ldb to sst
|
|
|
|
ansible.builtin.shell: rename -v .ldb .sst /var/lib/ceph/osd/*/current/omap/*.ldb
|
2017-08-22 22:43:01 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2019-04-01 23:46:15 +08:00
|
|
|
when: ldb_files.rc == 0
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Check if containerized osds are already running
|
|
|
|
ansible.builtin.command: >
|
2019-11-28 00:27:09 +08:00
|
|
|
{{ container_binary }} ps -q --filter='name=ceph-osd'
|
2017-08-22 22:43:01 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: osd_running
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get osd directories
|
|
|
|
ansible.builtin.command: >
|
2019-10-08 03:47:52 +08:00
|
|
|
find /var/lib/ceph/osd {% if dmcrypt | bool %}/var/lib/ceph/osd-lockbox{% endif %} -maxdepth 1 -mindepth 1 -type d
|
2018-11-19 21:58:03 +08:00
|
|
|
register: osd_dirs
|
2018-04-19 20:45:03 +08:00
|
|
|
changed_when: false
|
2019-11-28 00:27:09 +08:00
|
|
|
failed_when: false
|
2018-04-19 20:45:03 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Unmount all the osd directories
|
|
|
|
ansible.builtin.command: >
|
2019-10-08 03:47:52 +08:00
|
|
|
umount {{ item }}
|
2017-08-22 22:43:01 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2019-04-01 23:46:15 +08:00
|
|
|
with_items: "{{ osd_dirs.stdout_lines }}"
|
2019-11-28 00:27:09 +08:00
|
|
|
when: osd_running.rc != 0 or osd_running.stdout_lines | length == 0
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
tasks:
|
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-container-common role
|
|
|
|
ansible.builtin.import_role:
|
2019-05-20 15:46:10 +08:00
|
|
|
name: ceph-container-engine
|
|
|
|
|
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
|
2018-10-01 23:43:24 +08:00
|
|
|
|
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
|
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
post_tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Container - waiting for clean pgs...
|
|
|
|
ansible.builtin.command: >
|
2021-03-03 22:43:50 +08:00
|
|
|
{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_facts']['hostname'] }} ceph --cluster {{ cluster }} pg stat --format json
|
2017-10-07 01:52:05 +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)
|
2017-10-07 01:52:05 +08:00
|
|
|
and
|
2020-10-26 23:23:01 +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-10-07 01:52:05 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-08-22 22:43:01 +08:00
|
|
|
retries: "{{ health_osd_check_retries }}"
|
|
|
|
delay: "{{ health_osd_check_delay }}"
|
2020-10-02 18:55:53 +08:00
|
|
|
changed_when: false
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Unset osd flags
|
2020-04-03 21:36:23 +08:00
|
|
|
hosts: "{{ mon_group_name | default('mons') }}[0]"
|
2024-02-14 18:14:02 +08:00
|
|
|
become: true
|
2020-04-03 21:36:23 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-04-03 21:36:23 +08:00
|
|
|
name: ceph-defaults
|
2024-02-14 18:14:02 +08:00
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-04-03 21:36:23 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Re-enable pg autoscale on pools
|
2021-06-15 00:01:41 +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 }}"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Unset osd flags
|
2020-11-04 05:44:58 +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 }}"
|
2020-04-03 21:36:23 +08:00
|
|
|
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-06-15 00:01:41 +08:00
|
|
|
changed_when: false
|
2021-08-03 23:58:49 +08:00
|
|
|
when: (balancer_status_switch.stdout | from_json)['active'] | bool
|
2021-06-15 00:01:41 +08:00
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph mds
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ mds_group_name|default('mdss') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2017-08-25 20:36:07 +08:00
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
mds_group_name: mdss
|
|
|
|
|
2016-09-14 23:53:30 +08:00
|
|
|
serial: 1
|
|
|
|
become: true
|
2018-11-12 20:21:26 +08:00
|
|
|
pre_tasks:
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop non-containerized ceph mds(s)
|
|
|
|
ansible.builtin.service:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: "ceph-mds@{{ ansible_facts['hostname'] }}"
|
2017-08-22 22:43:01 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Remove old systemd unit files
|
|
|
|
ansible.builtin.file:
|
2020-09-15 21:46:30 +08:00
|
|
|
path: "{{ item }}"
|
2019-02-12 17:56:28 +08:00
|
|
|
state: absent
|
|
|
|
with_items:
|
2020-09-15 21:46:30 +08:00
|
|
|
- /usr/lib/systemd/system/ceph-mds@.service
|
|
|
|
- /usr/lib/systemd/system/ceph-mds.target
|
|
|
|
- /lib/systemd/system/ceph-mds@.service
|
|
|
|
- /lib/systemd/system/ceph-mds.target
|
2019-02-12 17:56:28 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-defaults
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-facts
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2019-10-07 15:19:50 +08:00
|
|
|
# NOTE: changed from file module to raw find command for performance reasons
|
2019-08-11 03:44:32 +08:00
|
|
|
# The file module has to run checks on current ownership of all directories and files. This is unnecessary
|
|
|
|
# as in this case we know we want all owned by ceph user
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set proper ownership on ceph directories
|
|
|
|
ansible.builtin.command: "find /var/lib/ceph/mds /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown {{ ceph_uid }}:{{ ceph_uid }} {} +"
|
2019-08-11 03:44:32 +08:00
|
|
|
changed_when: false
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
tasks:
|
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-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
2019-05-20 15:46:10 +08:00
|
|
|
name: ceph-container-engine
|
|
|
|
|
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
|
2018-10-01 23:43:24 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-mds role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-mds
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph rgw
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ rgw_group_name|default('rgws') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2017-08-25 20:36:07 +08:00
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
rgw_group_name: rgws
|
|
|
|
|
2016-09-14 23:53:30 +08:00
|
|
|
serial: 1
|
|
|
|
become: true
|
2018-11-12 20:21:26 +08:00
|
|
|
pre_tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-defaults
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-facts
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-config role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-01 16:47:45 +08:00
|
|
|
name: ceph-config
|
|
|
|
tasks_from: rgw_systemd_environment_file.yml
|
|
|
|
|
2019-10-07 15:19:50 +08:00
|
|
|
# NOTE: changed from file module to raw find command for performance reasons
|
2019-08-11 03:44:32 +08:00
|
|
|
# The file module has to run checks on current ownership of all directories and files. This is unnecessary
|
|
|
|
# as in this case we know we want all owned by ceph user
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set proper ownership on ceph directories
|
|
|
|
ansible.builtin.command: "find /var/lib/ceph/radosgw /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown {{ ceph_uid }}:{{ ceph_uid }} {} +"
|
2019-08-11 03:44:32 +08:00
|
|
|
changed_when: false
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop non-containerized ceph rgw(s)
|
|
|
|
ansible.builtin.service:
|
2024-05-08 02:41:53 +08:00
|
|
|
name: "ceph-radosgw@rgw.{{ rgw_zone }}.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}"
|
2019-02-12 21:03:39 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2019-02-12 21:03:39 +08:00
|
|
|
with_items: "{{ rgw_instances }}"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Remove old systemd unit files
|
|
|
|
ansible.builtin.file:
|
2020-09-15 21:46:30 +08:00
|
|
|
path: "{{ item }}"
|
2019-02-12 21:03:39 +08:00
|
|
|
state: absent
|
2020-08-04 01:03:34 +08:00
|
|
|
with_items:
|
2020-09-15 21:46:30 +08:00
|
|
|
- /usr/lib/systemd/system/ceph-radosgw@.service
|
|
|
|
- /usr/lib/systemd/system/ceph-radosgw.target
|
|
|
|
- /lib/systemd/system/ceph-radosgw@.service
|
|
|
|
- /lib/systemd/system/ceph-radosgw.target
|
2019-02-12 21:03:39 +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-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
2019-05-20 15:46:10 +08:00
|
|
|
name: ceph-container-engine
|
|
|
|
|
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
|
2018-10-01 23:43:24 +08:00
|
|
|
|
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
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph rbd-mirror
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2017-08-25 20:36:07 +08:00
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
rbdmirror_group_name: rbdmirrors
|
|
|
|
|
2016-09-14 23:53:30 +08:00
|
|
|
serial: 1
|
|
|
|
become: true
|
2018-11-12 20:21:26 +08:00
|
|
|
pre_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 ceph-rbd-mirror@* # noqa: command-instead-of-module
|
2022-08-02 02:18:50 +08:00
|
|
|
changed_when: false
|
|
|
|
register: rbdmirror_services
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop non-containerized ceph rbd mirror(s) # noqa: ignore-errors
|
|
|
|
ansible.builtin.service:
|
2022-08-02 02:18:50 +08:00
|
|
|
name: "{{ item.split('=')[1] }}"
|
2017-08-22 22:43:01 +08:00
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2022-10-17 16:20:21 +08:00
|
|
|
ignore_errors: true
|
2022-08-02 02:18:50 +08:00
|
|
|
loop: "{{ rbdmirror_services.stdout_lines }}"
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Remove old systemd unit files
|
|
|
|
ansible.builtin.file:
|
2020-09-15 21:46:30 +08:00
|
|
|
path: "{{ item }}"
|
2019-02-12 17:56:28 +08:00
|
|
|
state: absent
|
|
|
|
with_items:
|
2020-09-15 21:46:30 +08:00
|
|
|
- /usr/lib/systemd/system/ceph-rbd-mirror@.service
|
|
|
|
- /usr/lib/systemd/system/ceph-rbd-mirror.target
|
|
|
|
- /lib/systemd/system/ceph-rbd-mirror@.service
|
|
|
|
- /lib/systemd/system/ceph-rbd-mirror.target
|
2019-02-12 17:56:28 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-defaults
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2019-10-07 17:08:44 +08:00
|
|
|
name: ceph-facts
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2019-10-07 15:19:50 +08:00
|
|
|
# NOTE: changed from file module to raw find command for performance reasons
|
2019-08-11 03:44:32 +08:00
|
|
|
# The file module has to run checks on current ownership of all directories and files. This is unnecessary
|
|
|
|
# as in this case we know we want all owned by ceph user
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set proper ownership on ceph directories
|
|
|
|
ansible.builtin.command: "find /var/lib/ceph /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown {{ ceph_uid }}:{{ ceph_uid }} {} +"
|
2019-08-11 03:44:32 +08:00
|
|
|
changed_when: false
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
tasks:
|
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-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
2019-05-20 15:46:10 +08:00
|
|
|
name: ceph-container-engine
|
|
|
|
|
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
|
2018-10-01 23:43:24 +08:00
|
|
|
|
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
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
2024-06-17 22:35:10 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph nfs
|
|
|
|
|
|
|
|
hosts: "{{ nfs_group_name|default('nfss') }}"
|
|
|
|
|
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
nfs_group_name: nfss
|
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
pre_tasks:
|
|
|
|
|
|
|
|
# failed_when: false is here because if we're
|
|
|
|
# working with a jewel cluster then ceph nfs
|
|
|
|
# will not exist
|
|
|
|
- name: Stop non-containerized ceph nfs(s)
|
|
|
|
ansible.builtin.service:
|
|
|
|
name: nfs-ganesha
|
|
|
|
state: stopped
|
|
|
|
enabled: false
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
# NOTE: changed from file module to raw find command for performance reasons
|
|
|
|
# The file module has to run checks on current ownership of all directories and files. This is unnecessary
|
|
|
|
# as in this case we know we want all owned by ceph user
|
|
|
|
- name: Set proper ownership on ceph directories
|
|
|
|
ansible.builtin.command: "find /var/lib/ceph /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown {{ ceph_uid }}:{{ ceph_uid }} {} +"
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Import ceph-handler role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
|
|
|
- name: Import ceph-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
|
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-container-common
|
|
|
|
|
|
|
|
- name: Import ceph-nfs role
|
|
|
|
ansible.builtin.import_role:
|
|
|
|
name: ceph-nfs
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph-crash
|
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') }}"
|
|
|
|
|
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
become: true
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Stop non-containerized ceph-crash
|
|
|
|
ansible.builtin.service:
|
2020-07-03 16:21:49 +08:00
|
|
|
name: ceph-crash
|
|
|
|
state: stopped
|
2024-02-14 18:14:02 +08:00
|
|
|
enabled: false
|
2020-07-03 16:21:49 +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:
|
2021-04-09 15:24:05 +08:00
|
|
|
name: ceph-crash
|
|
|
|
|
2024-03-04 09:03:19 +08:00
|
|
|
- name: Switching from non-containerized to containerized ceph-exporter
|
|
|
|
|
|
|
|
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') }}"
|
|
|
|
|
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- 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: Final task
|
2021-04-09 15:24:05 +08:00
|
|
|
hosts:
|
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
|
|
|
- "{{ mgr_group_name|default('mgrs') }}"
|
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
become: true
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2021-04-09 15:24:05 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
# NOTE: changed from file module to raw find command for performance reasons
|
|
|
|
# The file module has to run checks on current ownership of all directories and files. This is unnecessary
|
|
|
|
# as in this case we know we want all owned by ceph user
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set proper ownership on ceph directories
|
|
|
|
ansible.builtin.command: "find /var/lib/ceph /etc/ceph -not -( -user {{ ceph_uid }} -or -group {{ ceph_uid }} -) -execdir chown {{ ceph_uid }}:{{ ceph_uid }} {} +"
|
2021-07-26 23:10:19 +08:00
|
|
|
changed_when: false
|