mirror of https://github.com/ceph/ceph-ansible.git
573 lines
14 KiB
Plaintext
573 lines
14 KiB
Plaintext
---
|
|
# Defines deployment design and assigns role to server groups
|
|
|
|
- hosts:
|
|
- mons
|
|
- agents
|
|
- osds
|
|
- mdss
|
|
- rgws
|
|
- nfss
|
|
- rbdmirrors
|
|
- clients
|
|
- mgrs
|
|
- iscsigws
|
|
- iscsi-gws # for backward compatibility only!
|
|
- grafana-server
|
|
- rgwloadbalancers
|
|
|
|
gather_facts: false
|
|
any_errors_fatal: true
|
|
become: true
|
|
|
|
tags: always
|
|
|
|
vars:
|
|
delegate_facts_host: True
|
|
|
|
pre_tasks:
|
|
# If we can't get python2 installed before any module is used we will fail
|
|
# so just try what we can to get it installed
|
|
|
|
- import_tasks: raw_install_python.yml
|
|
|
|
- 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: install required packages for fedora > 23
|
|
raw: sudo dnf -y install python2-dnf libselinux-python ntp
|
|
register: result
|
|
when:
|
|
- ansible_distribution == 'Fedora'
|
|
- ansible_distribution_major_version|int >= 23
|
|
until: result is succeeded
|
|
|
|
- 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
|
|
|
|
tasks:
|
|
- import_role:
|
|
name: ceph-defaults
|
|
- import_role:
|
|
name: ceph-facts
|
|
- import_role:
|
|
name: ceph-validate
|
|
- import_role:
|
|
name: ceph-infra
|
|
|
|
- hosts: mons
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-mon
|
|
- import_role:
|
|
name: ceph-mgr
|
|
when: groups.get(mgr_group_name, []) | length == 0
|
|
|
|
post_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
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- 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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-mgr
|
|
|
|
post_tasks:
|
|
- 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: agents
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- name: set ceph agent install 'In Progress'
|
|
run_once: true
|
|
set_stats:
|
|
data:
|
|
installer_phase_ceph_agent:
|
|
status: "In Progress"
|
|
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-agent
|
|
|
|
post_tasks:
|
|
- name: set ceph agent install 'Complete'
|
|
run_once: true
|
|
set_stats:
|
|
data:
|
|
installer_phase_ceph_agent:
|
|
status: "Complete"
|
|
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
|
|
|
|
- hosts: osds
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- 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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-osd
|
|
|
|
post_tasks:
|
|
- 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
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- 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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-mds
|
|
|
|
post_tasks:
|
|
- 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
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- 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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-rgw
|
|
|
|
post_tasks:
|
|
- 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
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- 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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-nfs
|
|
|
|
post_tasks:
|
|
- 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
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- 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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-rbd-mirror
|
|
|
|
post_tasks:
|
|
- 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
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- 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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-client
|
|
|
|
post_tasks:
|
|
- 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
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- 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') }}"
|
|
|
|
tasks:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-iscsi-gw
|
|
|
|
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:
|
|
- rgwloadbalancers
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- name: set ceph rgw loadbalancer install 'In Progress'
|
|
run_once: true
|
|
set_stats:
|
|
data:
|
|
installer_phase_ceph_rgw_loadbalancer:
|
|
status: "In Progress"
|
|
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
|
|
|
|
tasks:
|
|
- import_role:
|
|
name: ceph-defaults
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-facts
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-rgw-loadbalancer
|
|
|
|
post_tasks:
|
|
- name: set ceph rgw loadbalancer install 'Complete'
|
|
run_once: true
|
|
set_stats:
|
|
data:
|
|
installer_phase_ceph_rgw_loadbalancer:
|
|
status: "Complete"
|
|
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
|
|
|
|
- hosts: mons
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
tasks:
|
|
- import_role:
|
|
name: ceph-defaults
|
|
- name: get ceph status from the first monitor
|
|
command: ceph --cluster {{ cluster }} -s
|
|
register: ceph_status
|
|
changed_when: false
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
run_once: true
|
|
|
|
- name: "show ceph status for cluster {{ cluster }}"
|
|
debug:
|
|
msg: "{{ ceph_status.stdout_lines }}"
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
run_once: true
|
|
when: not ceph_status.failed
|
|
|
|
- hosts: all
|
|
become: true
|
|
tasks:
|
|
- block:
|
|
- import_role:
|
|
name: ceph-defaults
|
|
- import_role:
|
|
name: ceph-facts
|
|
- import_role:
|
|
name: ceph-handler
|
|
- import_role:
|
|
name: ceph-container-engine
|
|
- import_role:
|
|
name: ceph-node-exporter
|
|
when: dashboard_enabled | bool
|
|
|
|
- hosts: '{{ groups["grafana-server"][0] | default(groups["mgrs"][0]) | default(groups["mons"][0]) | default(omit) }}'
|
|
become: true
|
|
tasks:
|
|
- block:
|
|
- 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-common
|
|
- import_role:
|
|
name: ceph-config
|
|
tags: ['ceph_update_config']
|
|
- import_role:
|
|
name: ceph-prometheus
|
|
- import_role:
|
|
name: ceph-grafana
|
|
when: dashboard_enabled | bool
|
|
|
|
- hosts: '{{ groups["grafana-server"][0] | default(groups["mgrs"][0]) | default(groups["mons"][0]) | default(omit) }}'
|
|
become: true
|
|
tasks:
|
|
- import_role:
|
|
name: ceph-defaults
|
|
tags: ['ceph_update_config']
|
|
when: dashboard_enabled | bool
|
|
- import_role:
|
|
name: ceph-dashboard
|
|
when: dashboard_enabled | bool
|