2018-10-19 23:49:34 +08:00
---
# Defines deployment design and assigns role to server groups
2022-04-27 23:00:56 +08:00
- hosts: localhost
connection: local
tasks:
2022-06-15 15:16:26 +08:00
- name: Warn about ceph-ansible current status
fail:
2022-04-27 23:00:56 +08:00
msg: "cephadm is the new official installer. Please, consider migrating.
See https://docs.ceph.com/en/latest/cephadm/install for new deployments
or https://docs.ceph.com/en/latest/cephadm/adoption for migrating existing deployments."
2022-06-15 15:16:26 +08:00
when: not yes_i_know | default(false) | bool
2018-10-19 23:49:34 +08:00
- hosts:
- mons
- osds
- mdss
- rgws
2024-06-17 22:35:10 +08:00
- nfss
2018-10-19 23:49:34 +08:00
- rbdmirrors
- clients
- mgrs
2020-07-25 06:05:41 +08:00
- monitoring
2018-10-19 23:49:34 +08:00
gather_facts: false
become: True
any_errors_fatal: true
vars:
delegate_facts_host: True
2019-01-16 13:57:02 +08:00
pre_tasks:
- import_tasks: raw_install_python.yml
2018-11-21 01:03:14 +08:00
tasks:
# pre-tasks for following import -
2023-06-02 17:34:15 +08:00
- import_role:
name: ceph-defaults
2018-10-19 23:49:34 +08:00
- name: gather facts
setup:
2020-06-30 22:13:42 +08:00
gather_subset:
- 'all'
- '!facter'
- '!ohai'
2019-11-14 22:29:29 +08:00
when: not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, [])
tags: always
2018-10-19 23:49:34 +08:00
- name: gather and delegate facts
setup:
2020-06-30 22:13:42 +08:00
gather_subset:
- 'all'
- '!facter'
- '!ohai'
2018-10-19 23:49:34 +08:00
delegate_to: "{{ item }}"
delegate_facts: True
2019-10-02 21:36:30 +08:00
with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}"
2018-10-19 23:49:34 +08:00
run_once: true
2019-04-01 23:46:15 +08:00
when: delegate_facts_host | bool
2019-11-14 22:29:29 +08:00
tags: always
2018-10-19 23:49:34 +08:00
2021-03-16 21:51:06 +08:00
# dummy container setup is only supported on x86_64
# when running with containerized_deployment: true this task
# creates a group that contains only x86_64 hosts.
# when running with containerized_deployment: false this task
# will add all client hosts to the group (and not filter).
- name: create filtered clients group
add_host:
name: "{{ item }}"
groups: _filtered_clients
with_items: "{{ groups.get(client_group_name, []) | intersect(ansible_play_batch) }}"
2021-03-24 16:29:28 +08:00
when: (hostvars[item]['ansible_facts']['architecture'] == 'x86_64') or (not containerized_deployment | bool)
2021-03-16 21:51:06 +08:00
2018-10-19 23:49:34 +08:00
tags: [with_pkg, fetch_container_image]
2019-02-05 23:17:08 +08:00
- import_role:
name: ceph-facts
2019-03-15 05:03:16 +08:00
- import_role:
name: ceph-validate
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-infra
- import_role:
name: ceph-handler
2019-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-29 04:43:48 +08:00
tags: with_pkg
2021-03-16 21:51:06 +08:00
when: (group_names != ['clients'] and group_names != ['clients', '_filtered_clients'] and group_names != ['_filtered_clients', 'clients']) or (inventory_hostname == groups.get('_filtered_clients', [''])|first)
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-container-common
2019-05-29 04:43:48 +08:00
tags: fetch_container_image
2021-03-16 21:51:06 +08:00
when: (group_names != ['clients'] and group_names != ['clients', '_filtered_clients'] and group_names != ['_filtered_clients', 'clients']) or (inventory_hostname == groups.get('_filtered_clients', [''])|first)
2018-10-19 23:49:34 +08:00
- hosts: mons
2019-11-14 22:29:29 +08:00
gather_facts: false
2018-12-17 18:34:46 +08:00
any_errors_fatal: true
2018-10-19 23:49:34 +08:00
tasks:
- name: set ceph monitor install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_mon:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: mons
become: True
gather_facts: false
2018-11-26 18:06:10 +08:00
any_errors_fatal: true
2018-11-21 01:03:14 +08:00
tasks:
- import_role:
name: ceph-defaults
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-12-10 22:46:32 +08:00
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-handler
2019-10-04 20:58:11 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-config
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-mon
2018-10-16 21:40:35 +08:00
- import_role:
name: ceph-mgr
2024-03-06 20:37:06 +08:00
when: groups.get(mgr_group_name, []) | length == 0 or mgr_group_name in group_names
2018-10-16 21:40:35 +08:00
2018-10-19 23:49:34 +08:00
- hosts: mons
2019-11-14 22:29:29 +08:00
gather_facts: false
2018-12-17 18:34:46 +08:00
any_errors_fatal: true
2018-10-19 23:49:34 +08:00
tasks:
- name: set ceph monitor install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_mon:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: mgrs
become: True
gather_facts: false
2018-12-17 18:34:46 +08:00
any_errors_fatal: true
2018-11-21 01:03:14 +08:00
tasks:
# pre-tasks for following imports -
2018-10-19 23:49:34 +08:00
- name: set ceph manager install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_mgr:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-defaults
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-12-10 22:46:32 +08:00
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-handler
2019-10-04 20:58:11 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-config
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-mgr
# post-tasks for upcoming imports -
2018-10-19 23:49:34 +08:00
- name: set ceph manager install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_mgr:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: osds
become: True
gather_facts: false
2018-11-26 18:06:10 +08:00
any_errors_fatal: true
2018-11-21 01:03:14 +08:00
tasks:
# pre-tasks for upcoming imports -
2018-10-19 23:49:34 +08:00
- name: set ceph osd install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_osd:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-defaults
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-12-10 22:46:32 +08:00
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-handler
2019-10-04 20:58:11 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-config
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-osd
# post-tasks for preceding imports -
2018-10-19 23:49:34 +08:00
- name: set ceph osd install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_osd:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: mdss
become: True
gather_facts: false
2018-11-26 18:06:10 +08:00
any_errors_fatal: true
2018-11-21 01:03:14 +08:00
tasks:
# pre-tasks for following imports -
2018-10-19 23:49:34 +08:00
- name: set ceph mds install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_mds:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-defaults
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-12-10 22:46:32 +08:00
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-handler
2019-10-04 20:58:11 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-config
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-mds
# post-tasks for preceding imports -
2018-10-19 23:49:34 +08:00
- name: set ceph mds install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_mds:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: rgws
become: True
gather_facts: false
2018-11-26 18:06:10 +08:00
any_errors_fatal: true
2018-11-21 01:03:14 +08:00
tasks:
# pre-tasks for following imports -
2018-10-19 23:49:34 +08:00
- name: set ceph rgw install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_rgw:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-defaults
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-12-10 22:46:32 +08:00
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-handler
2019-10-04 20:58:11 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-config
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-rgw
# post-tasks for preceding imports -
2018-10-19 23:49:34 +08:00
- name: set ceph rgw install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_rgw:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2020-03-20 03:44:20 +08:00
- hosts: clients
2018-10-19 23:49:34 +08:00
become: True
gather_facts: false
2018-11-26 18:06:10 +08:00
any_errors_fatal: true
2020-11-12 22:19:42 +08:00
tags: 'ceph_client'
2018-11-21 01:03:14 +08:00
tasks:
# pre-tasks for following imports -
2020-03-20 03:44:20 +08:00
- name: set ceph client install 'In Progress'
2018-10-19 23:49:34 +08:00
run_once: true
set_stats:
data:
2020-03-20 03:44:20 +08:00
installer_phase_ceph_client:
2018-10-19 23:49:34 +08:00
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-defaults
2020-11-12 22:19:42 +08:00
tags: ['ceph_update_config']
2018-12-10 22:46:32 +08:00
- import_role:
name: ceph-facts
2020-11-12 22:19:42 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-handler
2020-11-12 22:19:42 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-config
2020-11-12 22:19:42 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
2020-03-20 03:44:20 +08:00
name: ceph-client
2018-11-21 01:03:14 +08:00
2020-03-20 03:44:20 +08:00
# post-tasks for preceding imports -
- name: set ceph client install 'Complete'
2018-10-19 23:49:34 +08:00
run_once: true
set_stats:
data:
2020-03-20 03:44:20 +08:00
installer_phase_ceph_client:
2018-10-19 23:49:34 +08:00
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2024-06-17 22:35:10 +08:00
- hosts: nfss
become: True
gather_facts: false
any_errors_fatal: true
tasks:
# pre-tasks for following imports -
- name: set ceph nfs install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_nfs:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
tags: ['ceph_update_config']
- import_role:
name: ceph-config
tags: ['ceph_update_config']
- import_role:
name: ceph-nfs
# post-tasks for following imports -
- name: set ceph nfs install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_nfs:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2020-03-20 03:44:20 +08:00
- hosts: rbdmirrors
2018-10-19 23:49:34 +08:00
become: True
gather_facts: false
2018-11-26 18:06:10 +08:00
any_errors_fatal: true
2018-11-21 01:03:14 +08:00
tasks:
# pre-tasks for following imports -
2020-03-20 03:44:20 +08:00
- name: set ceph rbd mirror install 'In Progress'
2018-10-19 23:49:34 +08:00
run_once: true
set_stats:
data:
2020-03-20 03:44:20 +08:00
installer_phase_ceph_rbdmirror:
2018-10-19 23:49:34 +08:00
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-defaults
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-12-10 22:46:32 +08:00
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-handler
2019-10-04 20:58:11 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-config
2018-10-19 23:49:34 +08:00
tags: ['ceph_update_config']
2018-11-21 01:03:14 +08:00
- import_role:
2020-03-20 03:44:20 +08:00
name: ceph-rbd-mirror
2018-11-21 01:03:14 +08:00
# post-tasks for preceding imports -
2020-03-20 03:44:20 +08:00
- name: set ceph rbd mirror install 'Complete'
2018-10-19 23:49:34 +08:00
run_once: true
set_stats:
data:
2020-03-20 03:44:20 +08:00
installer_phase_ceph_rbdmirror:
2018-10-19 23:49:34 +08:00
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2019-10-18 03:15:20 +08:00
- import_playbook: dashboard.yml
when:
- dashboard_enabled | bool
2020-07-25 06:05:41 +08:00
- groups.get(monitoring_group_name, []) | length > 0
2019-10-18 03:15:20 +08:00
2020-07-03 16:21:49 +08:00
- hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- mgrs
gather_facts: false
become: True
any_errors_fatal: true
2021-07-05 22:11:57 +08:00
pre_tasks:
- name: set ceph crash install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_crash:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2020-07-03 16:21:49 +08:00
tasks:
- 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
2021-07-05 22:11:57 +08:00
post_tasks:
- name: set ceph crash install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_crash:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2024-03-04 09:03:19 +08:00
- hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- mgrs
gather_facts: false
become: True
any_errors_fatal: true
pre_tasks:
- name: set ceph exporter install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_exporter:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
tasks:
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts
tasks_from: container_binary.yml
- import_role:
name: ceph-handler
- import_role:
name: ceph-exporter
post_tasks:
- name: set ceph exporter install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_exporter:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2020-07-03 16:21:49 +08:00
2024-03-15 04:39:45 +08:00
- hosts:
- mons
- osds
- mdss
- rgws
- rbdmirrors
- clients
- mgrs
- monitoring
gather_facts: false
become: True
any_errors_fatal: true
tasks:
- name: Remove tempdir for scripts
ansible.builtin.file:
path: "{{ tmpdirpath.path }}"
state: absent
when:
- tmpdirpath.path is defined
- not _exporter_handler_called | default(false) | bool
- not _crash_handler_called | default(false) | bool
- not _mds_handler_called | default(false) | bool
- not _mgr_handler_called | default(false) | bool
- not _mon_handler_called | default(false) | bool
- not _osd_handler_called | default(false) | bool
- not _rbdmirror_handler_called | default(false) | bool
- not _rgw_handler_called | default(false) | bool
2023-08-04 15:55:23 +08:00
- hosts: mons[0]
2018-10-19 23:49:34 +08:00
gather_facts: false
become: True
2018-12-17 18:34:46 +08:00
any_errors_fatal: true
2018-10-19 23:49:34 +08:00
tasks:
2018-12-10 22:46:32 +08:00
- import_role:
name: ceph-defaults
2019-01-16 17:27:23 +08:00
2018-11-19 22:14:55 +08:00
- name: check if podman binary is present
stat:
path: /usr/bin/podman
register: podman_binary
2019-01-16 17:27:23 +08:00
- name: set_fact container_binary
set_fact:
2023-06-02 17:34:15 +08:00
container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_facts['distribution'] == 'Fedora') or (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] in ['8', '9']) else 'docker' }}"
2019-01-16 17:27:23 +08:00
2018-10-19 23:49:34 +08:00
- name: get ceph status from the first monitor
2018-11-19 22:14:55 +08:00
command: >
2023-08-04 15:55:23 +08:00
{{ container_binary }} exec ceph-mon-{{ hostvars[inventory_hostname]['ansible_facts']['hostname'] }} ceph --cluster {{ cluster }} -s
2018-10-19 23:49:34 +08:00
register: ceph_status
changed_when: false
2018-12-10 22:46:32 +08:00
- name: "show ceph status for cluster {{ cluster }}"
2018-10-19 23:49:34 +08:00
debug:
msg: "{{ ceph_status.stdout_lines }}"
when: not ceph_status.failed