2021-04-12 15:25:25 +08:00
|
|
|
---
|
|
|
|
# This playbook is intended to be used as part of the el7 to el8 OS upgrade.
|
|
|
|
# It modifies the systemd unit files so containers are launched with podman
|
|
|
|
# instead of docker after the OS reboot once it is upgraded.
|
|
|
|
# It is *not* intended to restart services since we don't want multiple services
|
|
|
|
# restarts.
|
|
|
|
|
2019-07-24 16:39:47 +08:00
|
|
|
- hosts:
|
|
|
|
- mons
|
|
|
|
- osds
|
|
|
|
- mdss
|
|
|
|
- rgws
|
|
|
|
- nfss
|
|
|
|
- rbdmirrors
|
|
|
|
- clients
|
|
|
|
- iscsigws
|
|
|
|
- mgrs
|
2020-07-25 06:05:41 +08:00
|
|
|
- monitoring
|
2019-07-24 16:39:47 +08:00
|
|
|
|
|
|
|
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:
|
2020-06-30 22:13:42 +08:00
|
|
|
gather_subset:
|
|
|
|
- 'all'
|
|
|
|
- '!facter'
|
|
|
|
- '!ohai'
|
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:
|
2020-06-30 22:13:42 +08:00
|
|
|
gather_subset:
|
|
|
|
- 'all'
|
|
|
|
- '!facter'
|
|
|
|
- '!ohai'
|
2019-07-24 16:39:47 +08:00
|
|
|
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-07-25 06:05:41 +08:00
|
|
|
- "{{ monitoring_group_name | default('monitoring') }}"
|
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:
|
2021-04-09 17:02:12 +08:00
|
|
|
- name: set_fact docker2podman and container_binary
|
|
|
|
set_fact:
|
|
|
|
docker2podman: True
|
|
|
|
container_binary: podman
|
|
|
|
|
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-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
|
|
|
|
|
2021-03-18 18:36:59 +08:00
|
|
|
- name: check podman presence # noqa : 305
|
|
|
|
shell: command -v podman
|
2020-06-22 20:35:16 +08:00
|
|
|
register: podman_presence
|
2020-04-16 23:30:11 +08:00
|
|
|
changed_when: false
|
2020-06-22 20:35:16 +08:00
|
|
|
failed_when: false
|
2020-04-16 23:30:11 +08:00
|
|
|
|
2020-06-22 20:35:16 +08:00
|
|
|
- name: pulling images from docker daemon
|
|
|
|
when: podman_presence.rc == 0
|
|
|
|
block:
|
|
|
|
- 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
|
|
|
|
2020-06-22 20:35:16 +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
|
2020-07-25 06:05:41 +08:00
|
|
|
- inventory_hostname in groups.get(monitoring_group_name, [])
|
2020-06-22 20:35:16 +08:00
|
|
|
|
|
|
|
- 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
|
2020-04-17 00:17:12 +08:00
|
|
|
|
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-07-03 16:21:49 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-crash
|
|
|
|
tasks_from: systemd.yml
|
|
|
|
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, [])
|
|
|
|
|
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
|
2020-07-25 06:05:41 +08:00
|
|
|
when: inventory_hostname in groups.get(monitoring_group_name, [])
|
2020-04-17 00:17:12 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-grafana
|
|
|
|
tasks_from: systemd.yml
|
2020-07-25 06:05:41 +08:00
|
|
|
when: inventory_hostname in groups.get(monitoring_group_name, [])
|
2020-04-17 00:17:12 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-prometheus
|
|
|
|
tasks_from: systemd.yml
|
2020-07-25 06:05:41 +08:00
|
|
|
when: inventory_hostname in groups.get(monitoring_group_name, [])
|
2020-04-17 00:17:12 +08:00
|
|
|
|
2020-04-16 23:30:11 +08:00
|
|
|
- name: reload systemd daemon
|
2020-01-10 21:29:50 +08:00
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|