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

118 lines
3.1 KiB
YAML

---
- name: include system_checks.yml
include: system_checks.yml
- name: include check_mandatory_vars.yml
include: check_mandatory_vars.yml
- name: check if it is atomic host
stat:
path: /run/ostree-booted
register: stat_ostree
check_mode: no
- name: set_fact is_atomic
set_fact:
is_atomic: '{{ stat_ostree.stat.exists }}'
tags:
- always
- name: include pre_requisites/prerequisites.yml
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
- name: set_fact monitor_name ansible_hostname
set_fact:
monitor_name: "{{ ansible_hostname }}"
when:
- not mon_use_fqdn
- name: set_fact monitor_name ansible_fqdn
set_fact:
monitor_name: "{{ ansible_fqdn }}"
when:
- mon_use_fqdn
- name: get docker version
command: docker --version
changed_when: false
check_mode: no
register: docker_version
- name: set_fact docker_version docker_version.stdout.split
set_fact:
docker_version: "{{ docker_version.stdout.split(' ')[2] }}"
# 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.
- name: check if a cluster is already running
command: "docker ps -q --filter='name=ceph-mon-{{ ansible_hostname }}'"
register: ceph_health
changed_when: false
failed_when: false
check_mode: no
- name: include checks.yml
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.stdout_lines | length == 0
- not rolling_update | default(false)
- name: include misc/ntp_atomic.yml
include: misc/ntp_atomic.yml
when:
- is_atomic
- ansible_os_family == 'RedHat'
- ntp_service_enabled
- name: include misc/ntp_redhat.yml
include: misc/ntp_redhat.yml
when:
- not is_atomic
- ansible_os_family == 'RedHat'
- ntp_service_enabled
- name: include misc/ntp_debian.yml
include: misc/ntp_debian.yml
when:
- ansible_os_family == 'Debian'
- ntp_service_enabled
- name: include fetch_image.yml
include: fetch_image.yml
tags:
- fetch_container_image
- name: get ceph version
command: docker run --rm --entrypoint /usr/bin/ceph {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --version
changed_when: false
check_mode: no
register: ceph_version
- name: set_fact ceph_version ceph_version.stdout.split
set_fact:
ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
- name: include release.yml
include: release.yml
# NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml
# # because it creates the directories needed by the latter.
- name: include dirs_permissions.yml
include: dirs_permissions.yml
- name: include selinux.yml
include: selinux.yml
when:
- ansible_os_family == 'RedHat'