b2ac6e80cd
sudo requires a tty to function by default on centos. Instead of tweaking the sudo conf we can just add a tty. This has the added advantage of making the containers more friendly if you have to `docker exec -i <container> bash` into them. Change-Id: If97a02ca1d37c243a787d98ade54bde8d641aecd backport: liberty Partially-Implements: blueprint functional-testing-gate
62 lines
2.0 KiB
YAML
62 lines
2.0 KiB
YAML
---
|
|
# TODO(SamYaple): Improve check with a custom docker module to check if alive
|
|
- name: Checking if a rabbitmq_data exists
|
|
command: docker exec rabbitmq_data stat /var/lib/rabbitmq/.erlang.cookie
|
|
register: exists
|
|
changed_when: False
|
|
failed_when: False
|
|
always_run: True
|
|
|
|
- name: Starting RabbitMQ data container
|
|
docker:
|
|
tty: True
|
|
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: rabbitmq_data
|
|
image: "{{ rabbitmq_data_image_full }}"
|
|
volumes: "/var/lib/rabbitmq/"
|
|
|
|
- name: Starting RabbitMQ bootstrap container
|
|
docker:
|
|
tty: True
|
|
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: rabbitmq_bootstrap
|
|
image: "{{ rabbitmq_image_full }}"
|
|
volumes: "{{ node_config_directory }}/rabbitmq/:{{ container_config_directory }}/:ro"
|
|
volumes_from:
|
|
- "rabbitmq_data"
|
|
env:
|
|
KOLLA_BOOTSTRAP:
|
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
|
RABBITMQ_CLUSTER_COOKIE: "{{ rabbitmq_cluster_cookie }}"
|
|
when: exists.rc != 0
|
|
|
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
|
- name: Waiting for bootstrap container
|
|
command: docker wait rabbitmq_bootstrap
|
|
register: bootstrap_result
|
|
failed_when: bootstrap_result.stdout != "0"
|
|
when: exists.rc != 0
|
|
|
|
- name: Cleaning up bootstrap container
|
|
docker:
|
|
tty: True
|
|
image: "{{ rabbitmq_image_full }}"
|
|
name: "rabbitmq_bootstrap"
|
|
state: "absent"
|