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:
|
|
|
|
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:
|
|
|
|
path: /usr/lib/systemd/system/{{ item }}
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- ceph-mon@.service
|
|
|
|
- ceph-mon.target
|
|
|
|
|
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
|
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
|
|
|
|
|
|
|
- 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...
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s --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:
|
|
|
|
path: /usr/lib/systemd/system/{{ item }}
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- ceph-mgr@.service
|
|
|
|
- ceph-mgr.target
|
|
|
|
|
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
|
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-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
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
|
|
|
- name: set osd flags
|
|
|
|
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd set {{ item }}"
|
|
|
|
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
|
|
|
|
|
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-06-05 04:57:17 +08:00
|
|
|
systemctl list-units | grep -E "loaded * active" | grep -Eo 'ceph-osd@[0-9]+.service|ceph-volume|ceph\.target'
|
2019-04-12 04:20:41 +08:00
|
|
|
register: running_osds
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- 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 != []
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
|
|
- 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 01:52:05 +08:00
|
|
|
- name: container - waiting for clean pgs...
|
2018-11-20 00:13:37 +08:00
|
|
|
command: >
|
|
|
|
{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s --format json
|
2017-10-07 01:52:05 +08:00
|
|
|
register: ceph_health_post
|
|
|
|
until: >
|
2018-10-02 23:31:49 +08:00
|
|
|
(((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | length) > 0)
|
2017-10-07 01:52:05 +08:00
|
|
|
and
|
2020-05-15 16:58:40 +08:00
|
|
|
(((ceph_health_post.stdout | from_json).pgmap.pgs_by_state | selectattr('state_name', 'search', '^active\\+clean') | map(attribute='count') | list | sum) == (ceph_health_post.stdout | from_json).pgmap.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 }}"
|
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
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
|
|
|
- name: set osd flags
|
|
|
|
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset {{ item }}"
|
|
|
|
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:
|
|
|
|
path: /usr/lib/systemd/system/{{ item }}
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- ceph-mds@.service
|
|
|
|
- ceph-mds.target
|
|
|
|
|
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
|
|
|
|
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 }}"
|
|
|
|
|
|
|
|
- name: remove old systemd unit file
|
|
|
|
file:
|
|
|
|
path: /usr/lib/systemd/system/ceph-radosgw@.service
|
|
|
|
state: absent
|
|
|
|
|
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:
|
|
|
|
path: /usr/lib/systemd/system/{{ item }}
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- ceph-rbd-mirror@.service
|
|
|
|
- ceph-rbd-mirror.target
|
|
|
|
|
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
|