2019-07-24 16:39:47 +08:00
|
|
|
- hosts:
|
|
|
|
- mons
|
|
|
|
- osds
|
|
|
|
- mdss
|
|
|
|
- rgws
|
|
|
|
- nfss
|
|
|
|
- rbdmirrors
|
|
|
|
- clients
|
|
|
|
- iscsigws
|
|
|
|
- mgrs
|
|
|
|
- grafana-server
|
|
|
|
|
|
|
|
gather_facts: false
|
|
|
|
become: True
|
|
|
|
any_errors_fatal: true
|
|
|
|
|
|
|
|
vars:
|
|
|
|
delegate_facts_host: True
|
|
|
|
|
|
|
|
pre_tasks:
|
|
|
|
- import_tasks: "{{ playbook_dir }}/../raw_install_python.yml"
|
|
|
|
|
|
|
|
tasks:
|
2019-11-28 21:01:13 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
|
2019-07-24 16:39:47 +08:00
|
|
|
# pre-tasks for following import -
|
|
|
|
- name: gather facts
|
|
|
|
setup:
|
2019-10-02 21:36:30 +08:00
|
|
|
when: not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, [])
|
2019-07-24 16:39:47 +08:00
|
|
|
|
|
|
|
- name: gather and delegate facts
|
|
|
|
setup:
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
delegate_facts: True
|
2019-11-28 22:12:59 +08:00
|
|
|
with_items: "{{ groups['all'] | difference(groups.get(client_group_name | default('clients'), [])) }}"
|
2019-07-24 16:39:47 +08:00
|
|
|
run_once: true
|
|
|
|
when: delegate_facts_host | bool
|
|
|
|
|
|
|
|
- hosts:
|
|
|
|
- "{{ mon_group_name | default('mons') }}"
|
|
|
|
- "{{ osd_group_name | default('osds') }}"
|
|
|
|
- "{{ mds_group_name | default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name | default('rgws') }}"
|
|
|
|
- "{{ nfs_group_name | default('nfss') }}"
|
|
|
|
- "{{ mgr_group_name | default('mgrs') }}"
|
|
|
|
- "{{ iscsi_gw_group_name | default('iscsigws') }}"
|
|
|
|
- "{{ rbdmirror_group_name | default('rbdmirrors') }}"
|
2020-04-17 00:17:12 +08:00
|
|
|
- "{{ grafana_server_group_name|default('grafana-server') }}"
|
2020-04-16 23:30:11 +08:00
|
|
|
gather_facts: false
|
2019-07-24 16:39:47 +08:00
|
|
|
become: true
|
2020-04-16 23:30:11 +08:00
|
|
|
tasks:
|
2019-07-24 16:39:47 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
2019-12-02 16:47:21 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
2019-07-24 16:39:47 +08:00
|
|
|
|
2020-05-12 23:38:47 +08:00
|
|
|
- name: with docker configuration
|
|
|
|
when: container_binary == 'docker'
|
|
|
|
block:
|
|
|
|
- name: get docker version
|
|
|
|
command: docker --version
|
|
|
|
changed_when: false
|
|
|
|
check_mode: no
|
|
|
|
register: ceph_docker_version
|
2019-07-24 16:39:47 +08:00
|
|
|
|
2020-05-12 23:38:47 +08:00
|
|
|
- name: set_fact ceph_docker_version ceph_docker_version.stdout.split
|
|
|
|
set_fact:
|
|
|
|
ceph_docker_version: "{{ ceph_docker_version.stdout.split(' ')[2] }}"
|
2019-07-24 16:39:47 +08:00
|
|
|
|
2020-04-16 23:30:11 +08:00
|
|
|
- name: set_fact docker2podman and container_binary
|
2020-01-10 21:30:35 +08:00
|
|
|
set_fact:
|
|
|
|
docker2podman: True
|
|
|
|
container_binary: podman
|
|
|
|
|
2020-01-10 18:17:27 +08:00
|
|
|
- name: install podman
|
|
|
|
package:
|
|
|
|
name: podman
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2020-04-16 23:30:11 +08:00
|
|
|
tags: with_pkg
|
2020-01-10 18:17:27 +08:00
|
|
|
when: not is_atomic | bool
|
|
|
|
|
2020-04-16 23:30:11 +08:00
|
|
|
- name: "pulling {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} image from docker daemon"
|
|
|
|
command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
|
|
|
changed_when: false
|
|
|
|
register: pull_image
|
|
|
|
until: pull_image.rc == 0
|
|
|
|
retries: "{{ docker_pull_retry }}"
|
|
|
|
delay: 10
|
|
|
|
when: inventory_hostname in groups.get(mon_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(osd_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(mds_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(rgw_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(mgr_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(rbdmirror_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(iscsi_gw_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(nfs_group_name, [])
|
|
|
|
|
2020-04-17 00:17:12 +08:00
|
|
|
- name: "pulling alertmanager/grafana/prometheus images from docker daemon"
|
|
|
|
command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ item }}"
|
|
|
|
changed_when: false
|
|
|
|
register: pull_image
|
|
|
|
until: pull_image.rc == 0
|
|
|
|
retries: "{{ docker_pull_retry }}"
|
|
|
|
delay: 10
|
|
|
|
loop:
|
|
|
|
- "{{ alertmanager_container_image }}"
|
|
|
|
- "{{ grafana_container_image }}"
|
|
|
|
- "{{ prometheus_container_image }}"
|
|
|
|
when:
|
|
|
|
- dashboard_enabled | bool
|
|
|
|
- inventory_hostname in groups.get(grafana_server_group_name, [])
|
|
|
|
|
|
|
|
- name: "pulling {{ node_exporter_container_image }} image from docker daemon"
|
|
|
|
command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ node_exporter_container_image }}"
|
|
|
|
changed_when: false
|
|
|
|
register: pull_image
|
|
|
|
until: pull_image.rc == 0
|
|
|
|
retries: "{{ docker_pull_retry }}"
|
|
|
|
delay: 10
|
|
|
|
when: dashboard_enabled | bool
|
|
|
|
|
2019-07-24 16:39:47 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-mon
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
when: inventory_hostname in groups.get(mon_group_name, [])
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-iscsi-gw
|
2019-09-30 15:21:41 +08:00
|
|
|
tasks_from: systemd.yml
|
2019-07-24 16:39:47 +08:00
|
|
|
when: inventory_hostname in groups.get(iscsi_gw_group_name, [])
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mds
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
when: inventory_hostname in groups.get(mds_group_name, [])
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-mgr
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
when: inventory_hostname in groups.get(mgr_group_name, [])
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-nfs
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
when: inventory_hostname in groups.get(nfs_group_name, [])
|
|
|
|
|
2020-04-01 20:20:05 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-osd
|
|
|
|
tasks_from: container_options_facts.yml
|
|
|
|
when: inventory_hostname in groups.get(osd_group_name, [])
|
|
|
|
|
2019-07-24 16:39:47 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-osd
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
when: inventory_hostname in groups.get(osd_group_name, [])
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-rbd-mirror
|
2019-09-30 15:36:00 +08:00
|
|
|
tasks_from: systemd.yml
|
2019-07-24 16:39:47 +08:00
|
|
|
when: inventory_hostname in groups.get(rbdmirror_group_name, [])
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-rgw
|
2019-09-30 15:40:56 +08:00
|
|
|
tasks_from: systemd.yml
|
2019-09-30 15:36:00 +08:00
|
|
|
when: inventory_hostname in groups.get(rgw_group_name, [])
|
2020-01-10 21:29:50 +08:00
|
|
|
|
2020-04-17 00:17:12 +08:00
|
|
|
- name: dashboard configuration
|
|
|
|
when: dashboard_enabled | bool
|
|
|
|
block:
|
|
|
|
- import_role:
|
|
|
|
name: ceph-node-exporter
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: grafana.yml
|
|
|
|
when: inventory_hostname in groups.get(grafana_server_group_name, [])
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-grafana
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
when: inventory_hostname in groups.get(grafana_server_group_name, [])
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-prometheus
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
when: inventory_hostname in groups.get(grafana_server_group_name, [])
|
|
|
|
|
2020-04-16 23:30:11 +08:00
|
|
|
- name: reload systemd daemon
|
2020-01-10 21:29:50 +08:00
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|