2016-02-08 05:30:32 +08:00
---
# Defines deployment design and assigns role to server groups
2017-04-11 20:20:11 +08:00
- hosts:
- mons
- agents
- osds
- mdss
- rgws
- nfss
- restapis
- rbdmirrors
- clients
- iscsigws
- mgrs
2017-12-19 22:10:05 +08:00
2017-08-25 20:36:07 +08:00
gather_facts: false
2017-09-28 06:11:53 +08:00
become: True
2017-12-19 22:10:05 +08:00
vars:
delegate_facts_host: True
2017-09-28 06:11:53 +08:00
pre_tasks:
2017-12-19 22:10:05 +08:00
- name: gather facts
setup:
when:
2018-03-22 02:01:51 +08:00
- not delegate_facts_host | bool or inventory_hostname in groups.get('clients', [])
2017-12-19 22:10:05 +08:00
2017-08-30 16:44:18 +08:00
- name: gather and delegate facts
setup:
delegate_to: "{{ item }}"
delegate_facts: True
2018-03-22 02:01:51 +08:00
with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}"
2017-12-19 22:10:05 +08:00
when:
- delegate_facts_host | bool
2016-08-22 16:35:24 +08:00
2017-09-28 06:11:53 +08:00
- name: check if it is atomic host
stat:
path: /run/ostree-booted
register: stat_ostree
tags:
- always
- name: set_fact is_atomic
set_fact:
2018-02-17 00:21:24 +08:00
is_atomic: '{{ stat_ostree.stat.exists }}'
2017-09-28 06:11:53 +08:00
tags:
- always
roles:
- { role: ceph-defaults,
tags: [with_pkg, fetch_container_image],
2018-03-30 18:45:15 +08:00
when: "(((containerized_deployment | bool) and not (is_atomic | bool) and not (inventory_hostname in groups.get('clients', [False]))) or ((inventory_hostname == groups.get('clients', [False])|first) and (containerized_deployment | bool) and not (is_atomic | bool)))" }
2017-09-28 06:11:53 +08:00
- { role: ceph-docker-common,
tags: [with_pkg, fetch_container_image],
2018-03-30 18:45:15 +08:00
when: "(((containerized_deployment | bool) and not (is_atomic | bool) and not (inventory_hostname in groups.get('clients', [False]))) or ((inventory_hostname == groups.get('clients', [False])|first) and (containerized_deployment | bool) and not (is_atomic | bool)))" }
2017-09-28 06:11:53 +08:00
post_tasks:
- name: "pull {{ ceph_docker_image }} image"
command: "docker pull {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
changed_when: false
2018-03-30 18:45:15 +08:00
when: "((is_atomic and (ceph_docker_dev_image is undefined or not ceph_docker_dev_image) and not (inventory_hostname in groups.get('clients', [False]))) or (is_atomic and ((ceph_docker_dev_image is undefined) or not (ceph_docker_dev_image)) and (inventory_hostname == groups.get('clients', [False])|first)))"
2017-09-28 06:11:53 +08:00
2018-03-01 00:08:07 +08:00
- 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') }}"
2016-02-08 05:30:32 +08:00
- hosts: mons
become: True
2016-08-23 01:42:27 +08:00
gather_facts: false
2016-02-08 05:30:32 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-docker-common
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-mon
2016-02-08 05:30:32 +08:00
serial: 1 # MUST be '1' WHEN DEPLOYING MONITORS ON DOCKER CONTAINERS
2018-03-01 00:08:07 +08:00
- 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') }}"
2017-09-22 23:26:28 +08:00
- hosts: mgrs
become: True
gather_facts: false
2018-03-01 00:08:07 +08:00
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') }}"
2017-09-22 23:26:28 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2017-09-29 07:37:10 +08:00
- ceph-docker-common
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'], when: "ceph_release_num[ceph_release] >= ceph_release_num.luminous" }
2017-10-13 00:27:36 +08:00
- { role: ceph-mgr, when: "ceph_release_num[ceph_release] >= ceph_release_num.luminous" }
2018-03-01 00:08:07 +08:00
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') }}"
2017-09-22 23:26:28 +08:00
2016-02-08 05:30:32 +08:00
- hosts: osds
become: True
2017-08-25 20:36:07 +08:00
gather_facts: false
2018-03-01 00:08:07 +08:00
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') }}"
2016-02-08 05:30:32 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-docker-common
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-osd
2018-03-01 00:08:07 +08:00
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') }}"
2016-02-08 05:30:32 +08:00
- hosts: mdss
become: True
2017-08-25 20:36:07 +08:00
gather_facts: false
2018-03-01 00:08:07 +08:00
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') }}"
2016-02-08 05:30:32 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-docker-common
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-mds
2018-03-01 00:08:07 +08:00
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') }}"
2016-02-08 05:30:32 +08:00
- hosts: rgws
become: True
2017-08-25 20:36:07 +08:00
gather_facts: false
2018-03-01 00:08:07 +08:00
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') }}"
2016-02-08 05:30:32 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-docker-common
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-rgw
2018-03-01 00:08:07 +08:00
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') }}"
2016-02-08 05:30:32 +08:00
2016-05-06 02:20:03 +08:00
- hosts: nfss
become: True
2017-08-25 20:36:07 +08:00
gather_facts: false
2018-03-01 00:08:07 +08:00
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') }}"
2016-05-06 02:20:03 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2017-10-03 21:19:07 +08:00
- ceph-docker-common
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'], when: "ceph_release_num[ceph_release] >= ceph_release_num.luminous" }
2017-10-13 00:27:36 +08:00
- { role: ceph-nfs, when: "ceph_release_num[ceph_release] >= ceph_release_num.luminous" }
2018-03-01 00:08:07 +08:00
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') }}"
2016-05-06 02:20:03 +08:00
2017-09-08 15:51:03 +08:00
- hosts: rbdmirrors
2016-08-23 02:23:48 +08:00
become: True
2017-08-25 20:36:07 +08:00
gather_facts: false
2018-03-01 00:08:07 +08:00
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') }}"
2016-08-23 02:23:48 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-docker-common
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-rbd-mirror
2018-03-01 00:08:07 +08:00
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') }}"
2016-08-23 02:23:48 +08:00
2016-02-08 05:30:32 +08:00
- hosts: restapis
become: True
2017-08-25 20:36:07 +08:00
gather_facts: false
2018-03-01 00:08:07 +08:00
pre_tasks:
- name: set ceph rest api install 'In Progress'
run_once: true
set_stats:
data:
installer_phase_ceph_restapi:
status: "In Progress"
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2016-02-08 05:30:32 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-docker-common
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'] }
2017-07-29 04:48:13 +08:00
- ceph-restapi
2018-03-01 00:08:07 +08:00
post_tasks:
- name: set ceph rest api install 'Complete'
run_once: true
set_stats:
data:
installer_phase_ceph_restapi:
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
2017-03-16 17:17:08 +08:00
2017-07-07 23:01:58 +08:00
- hosts: clients
become: True
2017-08-25 20:36:07 +08:00
gather_facts: false
2018-03-01 00:08:07 +08:00
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') }}"
2017-07-07 23:01:58 +08:00
roles:
2018-02-09 00:44:19 +08:00
- { role: ceph-defaults, tags: ['ceph_update_config'] }
2018-03-30 18:45:15 +08:00
- { role: ceph-docker-common, when: "inventory_hostname == groups.get('clients', []) | first" }
2018-02-09 00:44:19 +08:00
- { role: ceph-config, tags: ['ceph_update_config'] }
- ceph-client
2018-03-01 00:08:07 +08:00
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') }}"