2015-06-25 14:33:28 +00:00
|
|
|
---
|
2015-07-05 07:20:16 +00:00
|
|
|
- name: Cleaning up temp file on localhost
|
|
|
|
local_action: file path=/tmp/kolla_mariadb_cluster state=absent
|
|
|
|
changed_when: False
|
|
|
|
always_run: True
|
|
|
|
run_once: True
|
|
|
|
|
2015-06-25 14:33:28 +00:00
|
|
|
- name: Creating temp file on localhost
|
2015-07-23 19:41:49 +02:00
|
|
|
local_action: copy content=None dest=/tmp/kolla_mariadb_cluster mode=0600
|
2015-06-25 14:33:28 +00:00
|
|
|
changed_when: False
|
|
|
|
always_run: True
|
|
|
|
run_once: True
|
|
|
|
|
|
|
|
# TODO(SamYaple): Improve failed_when check
|
|
|
|
- name: Checking if a previous cluster exists
|
|
|
|
command: docker exec mariadb stat /var/lib/mysql/grastate.dat
|
|
|
|
register: exists
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
always_run: True
|
|
|
|
run_once: True
|
|
|
|
|
|
|
|
- name: Writing hostname of host with existing cluster files to temp file
|
2015-07-31 20:46:05 +02:00
|
|
|
local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_mariadb_cluster mode=0600
|
2015-06-25 14:33:28 +00:00
|
|
|
changed_when: False
|
|
|
|
always_run: True
|
|
|
|
when: exists.rc == 0
|
|
|
|
|
|
|
|
- name: Registering host from temp file
|
|
|
|
set_fact:
|
|
|
|
delegate_host: "{{ lookup('file', '/tmp/kolla_mariadb_cluster') }}"
|
|
|
|
|
|
|
|
- name: Cleaning up temp file on localhost
|
2015-07-05 07:20:16 +00:00
|
|
|
local_action: file path=/tmp/kolla_mariadb_cluster state=absent
|
2015-06-25 14:33:28 +00:00
|
|
|
changed_when: False
|
|
|
|
always_run: True
|
|
|
|
run_once: True
|
|
|
|
|
2015-08-13 06:02:26 +00:00
|
|
|
- name: Starting MariaDB data container
|
|
|
|
docker:
|
2015-10-14 10:21:02 +00:00
|
|
|
tty: True
|
2015-08-13 06:02:26 +00:00
|
|
|
net: host
|
|
|
|
pull: "{{ docker_pull_policy }}"
|
|
|
|
restart_policy: "{{ docker_restart_policy }}"
|
|
|
|
restart_policy_retry: "{{ docker_restart_policy_retry }}"
|
|
|
|
state: reloaded
|
|
|
|
registry: "{{ docker_registry }}"
|
|
|
|
username: "{{ docker_registry_username }}"
|
|
|
|
password: "{{ docker_registry_password }}"
|
|
|
|
insecure_registry: "{{ docker_insecure_registry }}"
|
|
|
|
name: mariadb_data
|
2015-08-13 14:26:55 -07:00
|
|
|
image: "{{ mariadb_data_image_full }}"
|
2015-08-13 06:02:26 +00:00
|
|
|
volumes: "/var/lib/mysql/"
|
2015-06-25 14:33:28 +00:00
|
|
|
|
2015-08-13 06:02:26 +00:00
|
|
|
- name: Starting MariaDB bootstrap container
|
|
|
|
docker:
|
2015-10-14 10:21:02 +00:00
|
|
|
tty: True
|
2015-08-13 06:02:26 +00:00
|
|
|
net: host
|
|
|
|
pull: "{{ docker_pull_policy }}"
|
|
|
|
restart_policy: "no"
|
|
|
|
restart_policy_retry: "{{ docker_restart_policy_retry }}"
|
|
|
|
state: reloaded
|
|
|
|
registry: "{{ docker_registry }}"
|
|
|
|
username: "{{ docker_registry_username }}"
|
|
|
|
password: "{{ docker_registry_password }}"
|
|
|
|
insecure_registry: "{{ docker_insecure_registry }}"
|
|
|
|
name: mariadb
|
|
|
|
image: "{{ mariadb_image_full }}"
|
2015-10-01 07:43:18 +00:00
|
|
|
volumes: "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro"
|
2015-08-13 06:02:26 +00:00
|
|
|
volumes_from:
|
|
|
|
- "mariadb_data"
|
|
|
|
env:
|
2015-06-25 14:33:28 +00:00
|
|
|
KOLLA_BOOTSTRAP:
|
|
|
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
|
|
|
DB_ROOT_PASSWORD: "{{ database_password }}"
|
2015-07-26 10:39:07 +00:00
|
|
|
when: delegate_host == 'None' and inventory_hostname == groups['mariadb'][0]
|
2015-07-31 21:50:43 +00:00
|
|
|
|
|
|
|
- name: Sleeping for 15 seconds while the cluster starts
|
|
|
|
command: sleep 15
|
|
|
|
changed_when: False
|
|
|
|
when: delegate_host == 'None' and inventory_hostname == groups['mariadb'][0]
|