mirror of https://github.com/ceph/ceph-ansible.git
498 lines
13 KiB
Plaintext
498 lines
13 KiB
Plaintext
---
|
|
# Defines deployment design and assigns role to server groups
|
|
|
|
- hosts:
|
|
- mons
|
|
- agents
|
|
- osds
|
|
- mdss
|
|
- rgws
|
|
- nfss
|
|
- rbdmirrors
|
|
- clients
|
|
- iscsigws
|
|
- iscsi-gws # for backward compatibility only!
|
|
- mgrs
|
|
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
|
|
vars:
|
|
delegate_facts_host: True
|
|
|
|
tasks:
|
|
# pre-tasks for following import -
|
|
- name: gather facts
|
|
setup:
|
|
when:
|
|
- not delegate_facts_host | bool
|
|
|
|
- name: gather and delegate facts
|
|
setup:
|
|
delegate_to: "{{ item }}"
|
|
delegate_facts: True
|
|
with_items: "{{ groups['all'] }}"
|
|
run_once: true
|
|
when:
|
|
- delegate_facts_host | bool
|
|
|
|
- name: check if it is atomic host
|
|
stat:
|
|
path: /run/ostree-booted
|
|
register: stat_ostree
|
|
tags:
|
|
- always
|
|
|
|
- name: set_fact is_atomic
|
|
set_fact:
|
|
is_atomic: '{{ stat_ostree.stat.exists }}'
|
|
tags:
|
|
- always
|
|
|
|
- name: check if podman binary is present
|
|
stat:
|
|
path: /usr/bin/podman
|
|
register: podman_binary
|
|
|
|
- name: set_fact container_binary
|
|
set_fact:
|
|
container_binary: "{{ 'podman' if podman_binary.stat.exists and ansible_distribution == 'Fedora' else 'docker' }}"
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: [with_pkg, fetch_container_image]
|
|
- import_role:
|
|
name: ceph-validate
|
|
private: false
|
|
- import_role:
|
|
name: ceph-infra
|
|
private: false
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
tags: [with_pkg, fetch_container_image]
|
|
when:
|
|
- not (is_atomic | bool)
|
|
- (not (inventory_hostname in groups.get('clients', [])) or (inventory_hostname == groups.get('clients', [''])|first))
|
|
|
|
# post-tasks for upcoming import -
|
|
- name: "pull {{ ceph_docker_image }} image"
|
|
command: "{{ container_binary }} pull {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
|
register: container_pull
|
|
until: container_pull.rc == 0
|
|
retries: 5
|
|
delay: 5
|
|
changed_when: false
|
|
when:
|
|
- is_atomic
|
|
- (ceph_docker_dev_image is undefined or not ceph_docker_dev_image)
|
|
- (not (inventory_hostname in groups.get('clients', [])) or (inventory_hostname == groups.get('clients', [''])|first))
|
|
|
|
- hosts: mons
|
|
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
|
|
any_errors_fatal: true
|
|
tasks:
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
- import_role:
|
|
name: ceph-config
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-mon
|
|
private: false
|
|
- import_role:
|
|
name: ceph-mgr
|
|
private: false
|
|
|
|
- hosts: mons
|
|
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
|
|
tasks:
|
|
# pre-tasks for following imports -
|
|
- 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') }}"
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
- import_role:
|
|
name: ceph-config
|
|
private: fals
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-mgr
|
|
private: false
|
|
|
|
# post-tasks for upcoming imports -
|
|
- 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
|
|
any_errors_fatal: true
|
|
tasks:
|
|
# pre-tasks for upcoming imports -
|
|
- 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') }}"
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
- import_role:
|
|
name: ceph-config
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-osd
|
|
private: false
|
|
|
|
# post-tasks for preceding imports -
|
|
- 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
|
|
any_errors_fatal: true
|
|
tasks:
|
|
# pre-tasks for following imports -
|
|
- 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') }}"
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
- import_role:
|
|
name: ceph-config
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-mds
|
|
private: false
|
|
|
|
# post-tasks for preceding imports -
|
|
- 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
|
|
any_errors_fatal: true
|
|
tasks:
|
|
# pre-tasks for following imports -
|
|
- 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') }}"
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
- import_role:
|
|
name: ceph-config
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-rgw
|
|
private: false
|
|
|
|
# post-tasks for preceding imports -
|
|
- 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
|
|
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
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
- import_role:
|
|
name: ceph-config
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-nfs
|
|
private: false
|
|
|
|
# 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') }}"
|
|
|
|
- hosts: rbdmirrors
|
|
become: True
|
|
gather_facts: false
|
|
any_errors_fatal: true
|
|
tasks:
|
|
# pre-tasks for following imports -
|
|
- 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') }}"
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
- import_role:
|
|
name: ceph-config
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-rbd-mirror
|
|
private: false
|
|
|
|
# post-tasks for preceding imports -
|
|
- 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
|
|
any_errors_fatal: true
|
|
tasks:
|
|
# pre-tasks for following imports -
|
|
- 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') }}"
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
when:
|
|
- inventory_hostname == groups.get('clients', ['']) | first
|
|
- import_role:
|
|
name: ceph-config
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-client
|
|
private: false
|
|
|
|
# post-tasks for preceding imports -
|
|
- 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
|
|
any_errors_fatal: true
|
|
become: True
|
|
tasks:
|
|
# pre-tasks for following imports -
|
|
- 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') }}"
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-handler
|
|
private: false
|
|
- import_role:
|
|
name: ceph-container-common
|
|
private: false
|
|
- import_role:
|
|
name: ceph-config
|
|
private: false
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-iscsi-gw
|
|
private: false
|
|
|
|
# post-tasks for preceding imports -
|
|
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
|
|
tasks:
|
|
- name: check if podman binary is present
|
|
stat:
|
|
path: /usr/bin/podman
|
|
register: podman_binary
|
|
|
|
- name: get ceph status from the first monitor
|
|
command: >
|
|
{{ 'podman' if podman_binary.stat.exists and ansible_distribution == 'Fedora' else 'docker' }} exec ceph-mon-{{ hostvars[groups['mons'][0]]['ansible_hostname'] }} ceph --cluster {{ cluster | default ('ceph') }} -s
|
|
register: ceph_status
|
|
changed_when: false
|
|
delegate_to: "{{ groups['mons'][0] }}"
|
|
run_once: true
|
|
ignore_errors: true # we skip the error if mon_group_name is different than 'mons'
|
|
|
|
- name: "show ceph status for cluster {{ cluster | default ('ceph') }}"
|
|
debug:
|
|
msg: "{{ ceph_status.stdout_lines }}"
|
|
delegate_to: "{{ groups['mons'][0] }}"
|
|
run_once: true
|
|
when: not ceph_status.failed
|