aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/mariadb/tasks/lookup_cluster.yml
blob: efca14ee08ab1e4e0ca138c21087758da0a08d0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
- name: Cleaning up temp file on localhost
  local_action: file path=/tmp/kolla_mariadb_cluster state=absent
  changed_when: False
  check_mode: no
  run_once: True

- name: Creating temp file on localhost
  local_action: copy content=None dest=/tmp/kolla_mariadb_cluster mode=0644
  changed_when: False
  check_mode: no
  run_once: True

- name: Creating mariadb volume
  kolla_docker:
    action: "create_volume"
    common_options: "{{ docker_common_options }}"
    name: "mariadb"
  register: mariadb_volume

- name: Writing hostname of host with existing cluster files to temp file
  local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_mariadb_cluster mode=0644
  changed_when: False
  check_mode: no
  when: not mariadb_volume | changed

- name: Registering host from temp file
  set_fact:
    delegate_host: "{{ lookup('file', '/tmp/kolla_mariadb_cluster') }}"

- name: Cleaning up temp file on localhost
  local_action: file path=/tmp/kolla_mariadb_cluster state=absent
  changed_when: False
  check_mode: no
  run_once: True