94162bd08f
This brings Kolla images inline with FHS and should make finding locations of things more consistent and reliable with the linux world at large. Change-Id: Iece5b4da4bace0fb8b1f41a65ab2c852ec73e6f8 Closes-Bug: #1485742
82 lines
2.7 KiB
YAML
82 lines
2.7 KiB
YAML
---
|
|
- 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
|
|
|
|
- name: Creating temp file on localhost
|
|
local_action: copy content=None dest=/tmp/kolla_mariadb_cluster mode=0600
|
|
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
|
|
local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_mariadb_cluster mode=0600
|
|
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
|
|
local_action: file path=/tmp/kolla_mariadb_cluster state=absent
|
|
changed_when: False
|
|
always_run: True
|
|
run_once: True
|
|
|
|
- name: Starting MariaDB data container
|
|
docker:
|
|
docker_api_version: "{{ docker_api_version }}"
|
|
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
|
|
image: "{{ mariadb_data_image_full }}"
|
|
volumes: "/var/lib/mysql/"
|
|
|
|
- name: Starting MariaDB bootstrap container
|
|
docker:
|
|
docker_api_version: "{{ docker_api_version }}"
|
|
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 }}"
|
|
volumes: "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro"
|
|
volumes_from:
|
|
- "mariadb_data"
|
|
env:
|
|
KOLLA_BOOTSTRAP:
|
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
|
DB_ROOT_PASSWORD: "{{ database_password }}"
|
|
when: delegate_host == 'None' and inventory_hostname == groups['mariadb'][0]
|
|
|
|
- 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]
|