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

View File

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