Convert rabbitmq to named volume

Change-Id: I81413ffcaa4efb881d13fef62823d60b676e871d
Implements: blueprint docker-named-volumes
This commit is contained in:
SamYaple 2016-01-29 16:21:54 +00:00
parent da692dc4e6
commit 64a767db4d
2 changed files with 11 additions and 18 deletions

View File

@ -1,19 +1,10 @@
---
# 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
- name: Creating rabbitmq volume
kolla_docker:
action: "start_container"
action: "create_volume"
common_options: "{{ docker_common_options }}"
image: "{{ rabbitmq_data_image_full }}"
name: "rabbitmq_data"
volumes: "/var/lib/rabbitmq/"
name: "rabbitmq"
register: rabbitmq_volume
- name: Running RabbitMQ bootstrap container
kolla_docker:
@ -29,6 +20,7 @@
BOOTSTRAP:
name: "rabbitmq_bootstrap"
restart_policy: "never"
volumes: "{{ node_config_directory }}/rabbitmq/:{{ container_config_directory }}/:ro"
volumes_from: "rabbitmq_data"
when: exists.rc != 0
volumes:
- "{{ node_config_directory }}/rabbitmq/:{{ container_config_directory }}/:ro"
- "rabbitmq:/var/lib/rabbitmq/"
when: rabbitmq_volume | changed

View File

@ -5,5 +5,6 @@
common_options: "{{ docker_common_options }}"
image: "{{ rabbitmq_image_full }}"
name: "rabbitmq"
volumes: "{{ node_config_directory }}/rabbitmq/:{{ container_config_directory }}/:ro"
volumes_from: "rabbitmq_data"
volumes:
- "{{ node_config_directory }}/rabbitmq/:{{ container_config_directory }}/:ro"
- "rabbitmq:/var/lib/rabbitmq/"