4c4181d54a
Additionally fixed bootstrap issue caused by an ansible bug in some versions of the docker module. Closes-Bug: #1472270 Change-Id: Ia5a370db5ab7690854afcd63492ba7dbbea29835
40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
---
|
|
- name: Creating database
|
|
mysql_db:
|
|
login_host: "{{ database_address }}"
|
|
login_user: "{{ database_user }}"
|
|
login_password: "{{ database_password }}"
|
|
name: "{{ service_database_name }}"
|
|
register: database
|
|
run_once: True
|
|
|
|
- name: Creating database user and setting permissions
|
|
mysql_user:
|
|
login_host: "{{ database_address }}"
|
|
login_user: "{{ database_user }}"
|
|
login_password: "{{ database_password }}"
|
|
name: "{{ service_database_name }}"
|
|
password: "{{ service_database_password }}"
|
|
host: "%"
|
|
priv: "{{ service_database_name }}.*:ALL"
|
|
append_privs: "yes"
|
|
run_once: True
|
|
|
|
- include: start.yml
|
|
vars:
|
|
run_once: True
|
|
when: database|changed
|
|
|
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
|
- name: Waiting for bootstrap container to exit
|
|
command: docker wait "{{ container_name }}"
|
|
when: database|changed
|
|
|
|
- name: Cleaning up boostrap container
|
|
docker:
|
|
name: "{{ container_name }}"
|
|
image: "{{ container_image }}"
|
|
state: "absent"
|
|
run_once: True
|
|
when: database|changed
|