kolla-ansible/ansible/roles/ceph/tasks/bootstrap_mons.yml

54 lines
1.3 KiB
YAML

---
- name: Cleaning up temp file on localhost
file:
path: /tmp/kolla_ceph_cluster
state: absent
delegate_to: localhost
changed_when: False
check_mode: no
run_once: True
- name: Creating temp file on localhost
copy:
content: None
dest: /tmp/kolla_ceph_cluster
mode: 0644
delegate_to: localhost
changed_when: False
check_mode: no
run_once: True
- name: Creating ceph_mon_config volume
become: true
kolla_docker:
action: "create_volume"
common_options: "{{ docker_common_options }}"
name: "ceph_mon_config"
register: ceph_mon_config_volume
- name: Writing hostname of host with existing cluster files to temp file
copy:
content: "{{ inventory_hostname }}"
dest: /tmp/kolla_ceph_cluster
mode: 0644
delegate_to: localhost
changed_when: False
check_mode: no
when: not ceph_mon_config_volume.changed
- name: Registering host from temp file
set_fact:
delegate_host: "{{ lookup('file', '/tmp/kolla_ceph_cluster') }}"
- name: Cleaning up temp file on localhost
file:
path: /tmp/kolla_ceph_cluster
state: absent
delegate_to: localhost
changed_when: False
check_mode: no
run_once: True
- include_tasks: generate_cluster.yml
when: delegate_host == 'None' and inventory_hostname == groups['ceph-mon'][0]