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

99 lines
2.9 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
- name: get ceph version
command: docker run --entrypoint /usr/bin/ceph {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --version
changed_when: false
always_run: yes
register: ceph_version
- set_fact:
ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
- include: release.yml
# NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml
# # because it creates the directories needed by the latter.
- include: dirs_permissions.yml
- include: create_configs.yml
# 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'