2016-09-14 23:53:30 +08:00
|
|
|
---
|
|
|
|
# This playbook switches from non-containerized to containerized Ceph daemons
|
|
|
|
|
|
|
|
- name: confirm whether user really meant to switch from non-containerized to containerized ceph daemons
|
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: localhost
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
gather_facts: false
|
|
|
|
|
|
|
|
vars_prompt:
|
|
|
|
- name: ireallymeanit
|
|
|
|
prompt: Are you sure you want to switch from non-containerized to containerized ceph daemons?
|
|
|
|
default: 'no'
|
|
|
|
private: no
|
|
|
|
|
|
|
|
tasks:
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: exit playbook, if user did not mean to switch from non-containerized to containerized daemons?
|
|
|
|
fail:
|
|
|
|
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
|
|
|
|
|
|
|
|
2018-11-20 00:13:37 +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') }}"
|
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
become: true
|
|
|
|
|
2019-12-09 21:20:42 +08:00
|
|
|
vars:
|
|
|
|
delegate_facts_host: True
|
|
|
|
|
2016-09-14 23:53:30 +08:00
|
|
|
tasks:
|
2019-12-09 21:20:42 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
2017-08-25 20:36:07 +08:00
|
|
|
- name: gather and delegate facts
|
|
|
|
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 }}"
|
|
|
|
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
|
|
|
|
2016-09-14 23:53:30 +08:00
|
|
|
- name: switching from non-containerized to containerized ceph mon
|
|
|
|
vars:
|
2017-08-22 22:43:01 +08:00
|
|
|
containerized_deployment: true
|
2019-02-08 15:52:03 +08:00
|
|
|
switch_to_containers: True
|
2016-11-03 17:16:33 +08:00
|
|
|
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:
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: select a running monitor
|
|
|
|
set_fact: mon_host={{ item }}
|
|
|
|
with_items: "{{ groups[mon_group_name] }}"
|
|
|
|
when: item != inventory_hostname
|
|
|
|
|
|
|
|
- name: stop non-containerized ceph mon
|
|
|
|
service:
|
|
|
|
name: "ceph-mon@{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
2019-02-12 17:56:28 +08:00
|
|
|
- name: remove old systemd unit files
|
|
|
|
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
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2018-04-19 16:28:56 +08:00
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
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
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: set proper ownership on ceph directories
|
2020-11-16 23:31:11 +08:00
|
|
|
command: "find /var/lib/ceph /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
|
|
|
|
|
|
|
- name: check for existing old leveldb file extension (ldb)
|
|
|
|
shell: stat /var/lib/ceph/mon/*/store.db/*.ldb
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: ldb_files
|
|
|
|
|
|
|
|
- name: rename leveldb extension from ldb to sst
|
|
|
|
shell: rename -v .ldb .sst /var/lib/ceph/mon/*/store.db/*.ldb
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
when: ldb_files.rc == 0
|
|
|
|
|
2018-10-19 23:07:55 +08:00
|
|
|
- name: copy mon initial keyring in /etc/ceph to satisfy fetch config task in ceph-container-common
|
2018-10-03 19:39:35 +08:00
|
|
|
command: cp /var/lib/ceph/mon/{{ cluster }}-{{ ansible_hostname }}/keyring /etc/ceph/{{ cluster }}.mon.keyring
|
|
|
|
args:
|
|
|
|
creates: /etc/ceph/{{ cluster }}.mon.keyring
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
tasks:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
2018-12-10 22:46:32 +08:00
|
|
|
|
2019-05-20 15:46:10 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2018-12-10 22:46:32 +08:00
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-mon
|
|
|
|
|
2018-10-19 23:07:55 +08:00
|
|
|
post_tasks:
|
2019-02-11 18:20:30 +08:00
|
|
|
- name: waiting for the monitor to join the quorum...
|
2020-10-27 05:33:45 +08:00
|
|
|
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} quorum_status --format json"
|
2017-10-16 20:27:57 +08:00
|
|
|
register: ceph_health_raw
|
|
|
|
until: >
|
|
|
|
hostvars[mon_host]['ansible_hostname'] in (ceph_health_raw.stdout | from_json)["quorum_names"]
|
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
|
|
|
|
2017-09-05 21:18:01 +08:00
|
|
|
- name: switching from non-containerized to containerized ceph mgr
|
|
|
|
|
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
|
2017-09-05 21:18:01 +08:00
|
|
|
- name: stop non-containerized ceph mgr(s)
|
|
|
|
service:
|
|
|
|
name: "ceph-mgr@{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
2018-01-06 02:37:36 +08:00
|
|
|
failed_when: false
|
2017-09-05 21:18:01 +08:00
|
|
|
|
2019-02-12 17:56:28 +08:00
|
|
|
- name: remove old systemd unit files
|
|
|
|
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
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2017-09-05 21:18:01 +08:00
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
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
|
2017-09-05 21:18:01 +08:00
|
|
|
- name: set proper ownership on ceph directories
|
2020-11-16 23:31:11 +08:00
|
|
|
command: "find /var/lib/ceph /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:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
2019-05-20 15:46:10 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2018-10-01 23:43:24 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mgr
|
2017-09-05 21:18:01 +08:00
|
|
|
|
|
|
|
|
2020-04-03 21:36:23 +08:00
|
|
|
- name: set osd flags
|
|
|
|
hosts: "{{ mon_group_name | default('mons') }}[0]"
|
|
|
|
become: True
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
|
2016-09-14 23:53:30 +08:00
|
|
|
- name: switching from non-containerized to containerized ceph osd
|
|
|
|
|
|
|
|
vars:
|
2017-08-22 22:43:01 +08:00
|
|
|
containerized_deployment: true
|
2016-09-14 23:53:30 +08:00
|
|
|
osd_group_name: osds
|
2020-06-16 23:43:13 +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
|
|
|
|
2018-11-20 00:13:37 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
2019-04-12 04:20:41 +08:00
|
|
|
- name: collect running osds
|
|
|
|
shell: |
|
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
|
|
|
|
- name: disable ceph-osd@.service runtime-enabled
|
|
|
|
command: "systemctl disable --runtime {{ item }}"
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
with_items: "{{ running_osds.stdout_lines | default([])}}"
|
|
|
|
when: item.startswith('ceph-osd@')
|
|
|
|
|
2019-04-12 04:20:41 +08:00
|
|
|
- name: stop/disable/mask non-containerized ceph osd(s) (if any)
|
|
|
|
systemd:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
with_items: "{{ running_osds.stdout_lines | default([])}}"
|
|
|
|
when: running_osds != []
|
|
|
|
|
2020-11-26 17:11:36 +08:00
|
|
|
- name: disable ceph.target
|
|
|
|
systemd:
|
|
|
|
name: ceph.target
|
|
|
|
enabled: no
|
|
|
|
|
2018-11-16 23:15:24 +08:00
|
|
|
- name: remove old ceph-osd systemd units
|
|
|
|
file:
|
|
|
|
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
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
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
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: set proper ownership on ceph directories
|
2020-09-15 21:59:06 +08:00
|
|
|
command: "find /var/lib/ceph /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
|
|
|
|
|
|
|
- name: check for existing old leveldb file extension (ldb)
|
|
|
|
shell: stat /var/lib/ceph/osd/*/current/omap/*.ldb
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: ldb_files
|
|
|
|
|
|
|
|
- name: rename leveldb extension from ldb to sst
|
|
|
|
shell: rename -v .ldb .sst /var/lib/ceph/osd/*/current/omap/*.ldb
|
|
|
|
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
|
|
|
|
|
|
|
- name: check if containerized osds are already running
|
2018-11-19 21:58:03 +08:00
|
|
|
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
|
|
|
|
|
2018-11-19 21:58:03 +08:00
|
|
|
- name: get osd directories
|
|
|
|
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
|
|
|
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: unmount all the osd directories
|
2018-11-19 21:58:03 +08:00
|
|
|
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:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
2019-05-20 15:46:10 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2018-10-01 23:43:24 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-osd
|
|
|
|
|
2018-11-12 20:21:26 +08:00
|
|
|
post_tasks:
|
2017-10-07 09:42:09 +08:00
|
|
|
- name: get num_pgs
|
2018-11-20 00:13:37 +08:00
|
|
|
command: >
|
2020-10-26 23:23:01 +08:00
|
|
|
{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} pg stat --format json
|
2017-10-07 09:42:09 +08:00
|
|
|
register: ceph_pgs
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
2017-10-07 01:52:05 +08:00
|
|
|
- name: container - waiting for clean pgs...
|
2018-11-20 00:13:37 +08:00
|
|
|
command: >
|
2020-10-26 23:23:01 +08:00
|
|
|
{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_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_pgs.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-26 23:23:01 +08:00
|
|
|
when: (ceph_pgs.stdout | from_json).pg_summary.num_pgs != 0
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
2020-04-03 21:36:23 +08:00
|
|
|
- name: unset osd flags
|
|
|
|
hosts: "{{ mon_group_name | default('mons') }}[0]"
|
|
|
|
become: True
|
|
|
|
tasks:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
|
|
|
|
- name: set 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
|
|
|
|
|
2016-09-14 23:53:30 +08:00
|
|
|
- name: switching from non-containerized to containerized ceph mds
|
|
|
|
|
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
|
|
|
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: stop non-containerized ceph mds(s)
|
|
|
|
service:
|
|
|
|
name: "ceph-mds@{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2019-02-12 17:56:28 +08:00
|
|
|
- name: remove old systemd unit files
|
|
|
|
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
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
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
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: set proper ownership on ceph directories
|
2019-10-07 15:19:50 +08:00
|
|
|
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:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
2019-05-20 15:46:10 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2018-10-01 23:43:24 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mds
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph rgw
|
|
|
|
|
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:
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2020-07-01 16:47:45 +08:00
|
|
|
- import_role:
|
|
|
|
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
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: set proper ownership on ceph directories
|
2019-10-07 15:19:50 +08:00
|
|
|
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:
|
2019-02-12 21:03:39 +08:00
|
|
|
- name: stop non-containerized ceph rgw(s)
|
|
|
|
service:
|
|
|
|
name: "ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
with_items: "{{ rgw_instances }}"
|
|
|
|
|
2020-08-04 01:03:34 +08:00
|
|
|
- name: remove old systemd unit files
|
2019-02-12 21:03:39 +08:00
|
|
|
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
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
2019-05-20 15:46:10 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2018-10-01 23:43:24 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-rgw
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph rbd-mirror
|
|
|
|
|
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:
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: stop non-containerized ceph rbd mirror(s)
|
|
|
|
service:
|
2017-08-25 20:36:07 +08:00
|
|
|
name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}"
|
2017-08-22 22:43:01 +08:00
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
2019-02-12 17:56:28 +08:00
|
|
|
- name: remove old systemd unit files
|
|
|
|
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
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
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
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: set proper ownership on ceph directories
|
2019-10-07 15:19:50 +08:00
|
|
|
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:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
2019-05-20 15:46:10 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2018-10-01 23:43:24 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-rbd-mirror
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph nfs
|
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
hosts: "{{ nfs_group_name|default('nfss') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
2017-08-25 20:36:07 +08:00
|
|
|
vars:
|
|
|
|
containerized_deployment: true
|
|
|
|
nfs_group_name: nfss
|
|
|
|
|
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
|
|
|
|
2018-01-06 02:42:16 +08:00
|
|
|
# failed_when: false is here because if we're
|
|
|
|
# working with a jewel cluster then ceph nfs
|
|
|
|
# will not exist
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: stop non-containerized ceph nfs(s)
|
|
|
|
service:
|
2017-09-09 01:28:52 +08:00
|
|
|
name: nfs-ganesha
|
2017-08-22 22:43:01 +08:00
|
|
|
state: stopped
|
|
|
|
enabled: no
|
2018-01-06 02:42:16 +08:00
|
|
|
failed_when: false
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
2017-08-22 22:43:01 +08:00
|
|
|
|
2019-10-07 17:08:44 +08:00
|
|
|
- import_role:
|
|
|
|
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
|
2017-08-22 22:43:01 +08:00
|
|
|
- name: set proper ownership on ceph directories
|
2019-10-07 15:19:50 +08:00
|
|
|
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:
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
2019-05-20 15:46:10 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-container-engine
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
2018-10-19 23:07:55 +08:00
|
|
|
name: ceph-container-common
|
2018-10-01 23:43:24 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-nfs
|
2020-07-03 16:21:49 +08:00
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph-crash
|
|
|
|
|
|
|
|
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
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- name: stop non-containerized ceph-crash
|
|
|
|
service:
|
|
|
|
name: ceph-crash
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-crash
|