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
|
|
|
|
|
2016-01-25 16:04:26 +00:00
|
|
|
- name: Creating mariadb volume
|
|
|
|
kolla_docker:
|
|
|
|
action: "create_volume"
|
|
|
|
common_options: "{{ docker_common_options }}"
|
|
|
|
name: "mariadb"
|
|
|
|
register: mariadb_volume
|
2015-06-25 14:33:28 +00:00
|
|
|
|
|
|
|
- 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
|
2016-01-25 16:04:26 +00:00
|
|
|
when: not mariadb_volume | changed
|
2015-06-25 14:33:28 +00:00
|
|
|
|
|
|
|
- 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 bootstrap container
|
2015-12-25 22:39:07 +00:00
|
|
|
kolla_docker:
|
|
|
|
action: "start_container"
|
|
|
|
common_options: "{{ docker_common_options }}"
|
|
|
|
environment:
|
2015-06-25 14:33:28 +00:00
|
|
|
KOLLA_BOOTSTRAP:
|
|
|
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
|
|
|
DB_ROOT_PASSWORD: "{{ database_password }}"
|
2015-12-08 02:23:58 -08:00
|
|
|
DB_MAX_TIMEOUT: "{{ database_max_timeout }}"
|
2015-12-25 22:39:07 +00:00
|
|
|
image: "{{ mariadb_image_full }}"
|
2016-01-28 02:04:02 +00:00
|
|
|
labels:
|
|
|
|
BOOTSTRAP:
|
2015-12-25 22:39:07 +00:00
|
|
|
name: "mariadb"
|
|
|
|
restart_policy: "never"
|
2015-12-27 15:38:26 +00:00
|
|
|
volumes:
|
|
|
|
- "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro"
|
|
|
|
- "mariadb:/var/lib/mysql"
|
2016-01-25 16:04:26 +00:00
|
|
|
when:
|
|
|
|
- delegate_host == 'None'
|
|
|
|
- inventory_hostname == groups['mariadb'][0]
|
2015-07-31 21:50:43 +00:00
|
|
|
|
2015-12-08 02:23:58 -08:00
|
|
|
- name: Waiting for MariaDB service to be ready
|
2016-01-25 16:04:26 +00:00
|
|
|
command: "docker exec mariadb ls /var/lib/mysql/mariadb.pid"
|
2015-12-08 02:23:58 -08:00
|
|
|
register: bootstrap_result
|
2016-01-25 16:04:26 +00:00
|
|
|
when:
|
|
|
|
- delegate_host == 'None'
|
|
|
|
- inventory_hostname == groups['mariadb'][0]
|
|
|
|
until: bootstrap_result | success
|
2015-12-08 02:23:58 -08:00
|
|
|
changed_when: False
|
|
|
|
retries: 6
|
|
|
|
delay: 10
|