kolla-ansible/ansible/roles/rabbitmq/tasks/bootstrap.yml
Steven Dake bd5e5bbb64 Use one data container for all data volumes
The previous method of using the API image for a data container
worked, but resulted in more data being bindmounted and copied
into the system.  This patch resolves that by essentially using
a distro-type as a FROM in a Dockerfile to generate
distro-type-data.  Further all of the data containers used
throughout ansible are modified to use this new data container.

Change-Id: I8846573d4f2d4b98d4f46c770bfefc6d4c5cd0b5
Partially-Implements: blueprint one-data-container
2015-08-18 20:52:27 -07:00

54 lines
1.7 KiB
YAML

---
# TODO(SamYaple): Improve check with a custom docker module to check if alive
- name: Checking if a rabbitmq_data exists
command: docker inspect rabbitmq_data
register: exists
changed_when: False
failed_when: False
always_run: True
- name: Starting RabbitMQ 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: rabbitmq_data
image: "{{ rabbitmq_data_image_full }}"
volumes: "/var/lib/rabbitmq/"
- name: Starting RabbitMQ 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: rabbitmq_bootstrap
image: "{{ rabbitmq_image_full }}"
volumes: "{{ node_config_directory }}/rabbitmq/:/opt/kolla/rabbitmq/:ro"
volumes_from:
- "rabbitmq_data"
env:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
RABBITMQ_CLUSTER_COOKIE: "{{ rabbitmq_cluster_cookie }}"
when: exists.rc != 0
- name: Cleaning up boostrap container
docker:
image: "{{ rabbitmq_image_full }}"
name: "rabbitmq_bootstrap"
state: "absent"