2018-10-19 23:49:34 +08:00
---
# Defines deployment design and assigns role to server groups
- hosts:
- mons
- osds
- mdss
- rgws
- nfss
- rbdmirrors
- clients
- iscsigws
- iscsi-gws # for backward compatibility only!
- mgrs
2018-12-06 02:59:47 +08:00
- grafana-server
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 -
2018-10-19 23:49:34 +08:00
- name: gather facts
setup:
2019-04-01 23:46:15 +08:00
when: not delegate_facts_host | bool
2018-10-19 23:49:34 +08:00
- name: gather and delegate facts
setup:
delegate_to: "{{ item }}"
delegate_facts: True
with_items: "{{ groups['all'] }}"
run_once: true
2019-04-01 23:46:15 +08:00
when: delegate_facts_host | bool
2018-10-19 23:49:34 +08:00
- name: check if it is atomic host
stat:
path: /run/ostree-booted
register: stat_ostree
2019-04-01 23:46:15 +08:00
tags: always
2018-10-19 23:49:34 +08:00
- name: set_fact is_atomic
set_fact:
is_atomic: '{{ stat_ostree.stat.exists }}'
2019-04-01 23:46:15 +08:00
tags: always
2018-10-19 23:49:34 +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
- name: set_fact container_binary
set_fact:
2019-01-16 17:27:23 +08:00
container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_distribution == 'Fedora') or (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8') else 'docker' }}"
2018-11-19 22:14:55 +08:00
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-defaults
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
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
when: not (inventory_hostname in groups.get('clients', [])) or (inventory_hostname == groups.get('clients', [''])|first)
2018-10-19 23:49:34 +08:00
- hosts: mons
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-container-common
2018-12-06 02:59:47 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
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
2019-02-22 17:50:22 +08:00
when: groups.get(mgr_group_name, []) | length == 0
2018-10-16 21:40:35 +08:00
2018-10-19 23:49:34 +08:00
- hosts: mons
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-container-common
2018-12-06 02:59:47 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-container-common
2018-12-06 02:59:47 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-container-common
2018-12-06 02:59:47 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-container-common
2018-12-06 02:59:47 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
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') }}"
- hosts: nfss
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 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') }}"
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-container-common
2018-12-06 02:59:47 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
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-nfs
# post-tasks for following imports -
2018-10-19 23:49:34 +08:00
- 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') }}"
- hosts: rbdmirrors
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 rbd mirror install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_rbdmirror:
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-container-common
2018-12-06 02:59:47 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
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-rbd-mirror
# post-tasks for preceding imports -
2018-10-19 23:49:34 +08:00
- name: set ceph rbd mirror install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_rbdmirror:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: clients
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 client install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_client:
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
when: inventory_hostname == groups.get('clients', ['']) | first or dashboard_enabled
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-container-common
2019-04-01 23:46:15 +08:00
when: inventory_hostname == groups.get('clients', ['']) | first
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
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-client
# post-tasks for preceding imports -
2018-10-19 23:49:34 +08:00
- name: set ceph client install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_client:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts:
- iscsigws
- iscsi-gws # for backward compatibility only!
gather_facts: false
2018-11-26 18:06:10 +08:00
any_errors_fatal: true
2018-10-19 23:49:34 +08:00
become: 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 iscsi gateway install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_iscsi_gw:
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
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-05-20 15:46:10 +08:00
- import_role:
name: ceph-container-engine
2019-05-17 23:34:09 +08:00
- import_role:
name: ceph-container-common
2018-12-06 02:59:47 +08:00
- import_role:
name: ceph-node-exporter
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
2018-11-21 01:03:14 +08:00
- import_role:
name: ceph-config
tags: ['ceph_update_config']
- import_role:
name: ceph-iscsi-gw
# post-tasks for preceding imports -
2018-10-19 23:49:34 +08:00
post_tasks:
- name: set ceph iscsi gw install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_iscsi_gw:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: mons
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:
container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_distribution == 'Fedora') or (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8') else 'docker' }}"
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: >
2019-01-16 17:27:23 +08:00
{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_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
delegate_to: "{{ groups[mon_group_name][0] }}"
2018-10-19 23:49:34 +08:00
run_once: true
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 }}"
2018-12-10 22:46:32 +08:00
delegate_to: "{{ groups[mon_group_name][0] }}"
2018-10-19 23:49:34 +08:00
run_once: true
when: not ceph_status.failed
2018-12-06 02:59:47 +08:00
2019-05-23 22:21:08 +08:00
- hosts: '{{ groups["grafana-server"][0] | default(groups["mgrs"][0]) | default(groups["mons"][0]) | default(omit) }}'
2018-12-06 02:59:47 +08:00
become: true
2019-06-18 03:52:04 +08:00
pre_tasks:
- name: set ceph grafana install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_grafana:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2019-06-29 02:14:53 +08:00
when: dashboard_enabled | bool
2019-06-18 03:52:04 +08:00
2018-12-06 02:59:47 +08:00
tasks:
2019-05-15 20:11:00 +08:00
- block:
2019-06-14 21:27:11 +08:00
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-facts
tags: ['ceph_update_config']
- import_role:
name: ceph-handler
- import_role:
name: ceph-container-engine
- import_role:
name: ceph-container-common
- import_role:
name: ceph-node-exporter
- import_role:
name: ceph-config
tags: ['ceph_update_config']
- import_role:
name: ceph-prometheus
- import_role:
name: ceph-grafana
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
2018-12-06 02:59:47 +08:00
2019-06-18 03:52:04 +08:00
post_tasks:
- name: set ceph grafana install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_grafana:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2019-06-29 02:14:53 +08:00
when: dashboard_enabled | bool
2019-06-18 03:52:04 +08:00
2019-06-14 21:27:11 +08:00
- hosts: '{{ groups["mgrs"][0] | default(groups["mons"][0]) | default(omit) }}'
2018-12-06 02:59:47 +08:00
become: true
2019-06-18 03:52:04 +08:00
pre_tasks:
- name: set ceph dashboard install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_dashboard:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2019-06-29 02:14:53 +08:00
when: dashboard_enabled | bool
2019-06-18 03:52:04 +08:00
2018-12-06 02:59:47 +08:00
tasks:
2019-05-15 20:11:00 +08:00
- block:
- import_role:
name: ceph-defaults
tags: ['ceph_update_config']
- import_role:
name: ceph-dashboard
2019-05-22 16:02:42 +08:00
when: dashboard_enabled | bool
2019-06-18 03:52:04 +08:00
post_tasks:
- name: set ceph dashboard install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_dashboard:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2019-06-29 02:14:53 +08:00
when: dashboard_enabled | bool