mirror of https://github.com/ceph/ceph-ansible.git
525 lines
13 KiB
Plaintext
525 lines
13 KiB
Plaintext
---
|
|
# Defines deployment design and assigns role to server groups
|
|
|
|
- hosts: localhost
|
|
connection: local
|
|
tasks:
|
|
- name: Warn about ceph-ansible current status
|
|
fail:
|
|
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."
|
|
when: not yes_i_know | default(false) | bool
|
|
|
|
- hosts:
|
|
- mons
|
|
- osds
|
|
- mdss
|
|
- rgws
|
|
- nfss
|
|
- rbdmirrors
|
|
- clients
|
|
- mgrs
|
|
- monitoring
|
|
- rgwloadbalancers
|
|
|
|
gather_facts: false
|
|
any_errors_fatal: true
|
|
become: true
|
|
|
|
tags: always
|
|
|
|
vars:
|
|
delegate_facts_host: True
|
|
|
|
pre_tasks:
|
|
- import_role:
|
|
name: ceph-defaults
|
|
# 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:
|
|
gather_subset:
|
|
- 'all'
|
|
- '!facter'
|
|
- '!ohai'
|
|
when:
|
|
- not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, [])
|
|
|
|
- name: gather and delegate facts
|
|
setup:
|
|
gather_subset:
|
|
- 'all'
|
|
- '!facter'
|
|
- '!ohai'
|
|
delegate_to: "{{ item }}"
|
|
delegate_facts: True
|
|
with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}"
|
|
run_once: true
|
|
when: delegate_facts_host | bool
|
|
|
|
tasks:
|
|
|
|
# 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) }}"
|
|
when: (hostvars[item]['ansible_facts']['architecture'] == 'x86_64') or (not containerized_deployment | bool)
|
|
|
|
- import_role:
|
|
name: ceph-facts
|
|
- import_role:
|
|
name: ceph-handler
|
|
- import_role:
|
|
name: ceph-validate
|
|
- import_role:
|
|
name: ceph-infra
|
|
- import_role:
|
|
name: ceph-common
|
|
|
|
- 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
|
|
tags: ['ceph_update_config']
|
|
- 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 or mgr_group_name in group_names
|
|
|
|
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
|
|
tags: ['ceph_update_config']
|
|
- 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: 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
|
|
tags: ['ceph_update_config']
|
|
- 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
|
|
tags: ['ceph_update_config']
|
|
- 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
|
|
tags: ['ceph_update_config']
|
|
- 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: clients
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
tags: 'ceph_client'
|
|
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
|
|
tags: ['ceph_update_config']
|
|
- 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: 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
|
|
tags: ['ceph_update_config']
|
|
- 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
|
|
tags: ['ceph_update_config']
|
|
- 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:
|
|
- 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') }}"
|
|
|
|
- import_playbook: dashboard.yml
|
|
when:
|
|
- dashboard_enabled | bool
|
|
- groups.get(monitoring_group_name, []) | length > 0
|
|
|
|
- hosts:
|
|
- mons
|
|
- osds
|
|
- mdss
|
|
- rgws
|
|
- rbdmirrors
|
|
- mgrs
|
|
|
|
gather_facts: false
|
|
become: True
|
|
any_errors_fatal: true
|
|
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') }}"
|
|
|
|
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
|
|
|
|
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') }}"
|
|
|
|
- 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
|
|
|
|
- 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:
|
|
- ceph_status is not skipped
|
|
- ceph_status is successful
|