ceph-ansible/roles/ceph-docker-common/tasks/main.yml

99 lines
3.2 KiB
YAML

---
- include: system_checks.yml
- name: check if it is atomic host
stat: path=/run/ostree-booted
register: stat_ostree
always_run: true
- name: set fact for using atomic host
set_fact:
is_atomic: '{{ stat_ostree.stat.exists }}'
- include: ./pre_requisites/prerequisites.yml
when: not is_atomic
# NOTE(guits): would be nice to refact this block with L39-45 in roles/ceph-common/tasks/facts.yml
- set_fact:
monitor_name: "{{ ansible_hostname }}"
when: not mon_use_fqdn
- set_fact:
monitor_name: "{{ ansible_fqdn }}"
when: mon_use_fqdn
- name: check if a cluster is already running
command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'"
register: ceph_health
changed_when: false
failed_when: false
always_run: true
# Only include 'checks.yml' when :
# we are deploying containers without kv AND host is either a mon OR a nfs OR an osd,
# AND
# a cluster is not already running,
# AND
# we are not playing rolling-update.yml playbook.
- include: checks.yml
when:
- (not containerized_deployment_with_kv and
((inventory_hostname in groups.get(mon_group_name, [])) or
(inventory_hostname in groups.get(nfs_group_name, [])) or
(inventory_hostname in groups.get(osd_group_name, []))))
- ceph_health.rc != 0
- not "{{ rolling_update | default(false) }}"
- include: "./misc/ntp_atomic.yml"
when:
- is_atomic
- ansible_os_family == 'RedHat'
- ntp_service_enabled
- include: "./misc/ntp_redhat.yml"
when:
- not is_atomic
- ansible_os_family == 'RedHat'
- ntp_service_enabled
- include: "./misc/ntp_debian.yml"
when:
- ansible_os_family == 'Debian'
- ntp_service_enabled
- include: "./fetch_image.yml"
# NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml
# # because it creates the directories needed by the latter.
- include: ./dirs_permissions.yml
# let the first mon create configs and keyrings
# Only include 'create_configs.yml" when:
# we are not populating kv_store with default ceph.conf AND host is a mon
# OR
# we are not population kv_store with default ceph.conf AND there at least 1 nfs in nfs group AND host is the first nfs
- include: create_configs.yml
when:
- (not mon_containerized_default_ceph_conf_with_kv and
(inventory_hostname in groups.get(mon_group_name, []))) or
(not mon_containerized_default_ceph_conf_with_kv and
((groups.get(nfs_group_name, []) | length > 0)
and (inventory_hostname == groups.get(nfs_group_name, [])[0])))
# Only include 'fetch_configs.yml' when:
# - we are deploying containers without kv AND host is either a mon OR a nfs OR an osd
# OR
# - host is either a mdss OR mgrs OR rgws
- include: fetch_configs.yml
when:
- (not containerized_deployment_with_kv and
((inventory_hostname in groups.get(mon_group_name, [])) or
(inventory_hostname in groups.get(nfs_group_name, [])) or
(inventory_hostname in groups.get(osd_group_name, [])))) or
(inventory_hostname in groups.get('mdss', [])) or
(inventory_hostname in groups.get('mgrs', [])) or
(inventory_hostname in groups.get('rgws', []))
- include: selinux.yml
when: ansible_os_family == 'RedHat'