kolla-ansible/ansible/roles/mariadb/tasks/lookup_cluster.yml
caoyuan 5cd55bf236 Optimize reconfiguration for mariadb
Change-Id: I278609f9832955849bc9381120a1b260f5a03f1b
Partially-implements: blueprint better-reconfigure
2017-07-22 08:50:08 +08:00

36 lines
1.0 KiB
YAML

---
- 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='' 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:
has_cluster: "{{ lookup('file', '/tmp/kolla_mariadb_cluster') | length > 0 }}"
- 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