8af400733d
This intentionally leaves out rabbitmq from this patchset. It will require additional work to remove its data container UpgradeImpact Partially-Implements: blueprint docker-named-volumes Change-Id: Id68b8e43a3c077ef4f4f4d67ea34d0692e66eef7
59 lines
1.8 KiB
YAML
59 lines
1.8 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 bootstrap container
|
|
kolla_docker:
|
|
action: "start_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
environment:
|
|
KOLLA_BOOTSTRAP:
|
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
|
DB_ROOT_PASSWORD: "{{ database_password }}"
|
|
image: "{{ mariadb_image_full }}"
|
|
name: "mariadb"
|
|
restart_policy: "never"
|
|
volumes:
|
|
- "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro"
|
|
- "mariadb:/var/lib/mysql"
|
|
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]
|