diff --git a/ansible/roles/rabbitmq/defaults/main.yml b/ansible/roles/rabbitmq/defaults/main.yml index d988806154..b3ae1e9ca0 100644 --- a/ansible/roles/rabbitmq/defaults/main.yml +++ b/ansible/roles/rabbitmq/defaults/main.yml @@ -4,15 +4,9 @@ project_name: "rabbitmq" #################### # Docker #################### -docker_message_broker_registry: "{{ docker_registry ~ '/' if docker_registry else '' }}" -docker_message_broker_namespace: "{{ docker_namespace }}" -kolla_message_broker_base_distro: "{{ kolla_base_distro }}" -kolla_message_broker_install_type: "{{ kolla_install_type }}" -kolla_message_broker_container_name: "rabbitmq" - -docker_message_broker_image: "{{ docker_message_broker_registry }}{{ docker_message_broker_namespace }}/{{ kolla_message_broker_base_distro }}-{{ kolla_message_broker_install_type }}-{{ kolla_message_broker_container_name }}" -docker_message_broker_tag: "{{ openstack_release }}" -docker_message_broker_image_full: "{{ docker_message_broker_image }}:{{ docker_message_broker_tag }}" +rabbitmq_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-rabbitmq" +rabbitmq_tag: "{{ openstack_release }}" +rabbitmq_image_full: "{{ rabbitmq_image }}:{{ rabbitmq_tag }}" #################### diff --git a/ansible/roles/rabbitmq/tasks/bootstrap.yml b/ansible/roles/rabbitmq/tasks/bootstrap.yml index df974055b7..97cba11643 100644 --- a/ansible/roles/rabbitmq/tasks/bootstrap.yml +++ b/ansible/roles/rabbitmq/tasks/bootstrap.yml @@ -7,32 +7,48 @@ failed_when: False always_run: True -- include: ../../start.yml - vars: - container_command: "/bin/sleep infinity" - container_image: "{{ docker_message_broker_image_full }}" - container_name: "rabbitmq_data" - container_volumes: - - "/var/lib/rabbitmq/" +- 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_image_full }}" + command: "/bin/sleep infinity" + volumes: "/var/lib/rabbitmq/" -- include: ../../start.yml - vars: - container_detach: "False" - container_environment: +- 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 }}" - container_image: "{{ docker_message_broker_image_full }}" - container_name: "rabbitmq_bootstrap" - container_restart_policy: "no" - container_volumes: - - "{{ node_config_directory }}/rabbitmq/:/opt/kolla/rabbitmq/:ro" - container_volumes_from: - - "rabbitmq_data" when: exists.rc != 0 - name: Cleaning up boostrap container docker: - image: "{{ docker_message_broker_image_full }}" + image: "{{ rabbitmq_image_full }}" name: "rabbitmq_bootstrap" state: "absent" diff --git a/ansible/roles/rabbitmq/tasks/start.yml b/ansible/roles/rabbitmq/tasks/start.yml index 4a75e0d944..664dee442c 100644 --- a/ansible/roles/rabbitmq/tasks/start.yml +++ b/ansible/roles/rabbitmq/tasks/start.yml @@ -1,11 +1,20 @@ --- -- include: ../../start.yml - vars: - container_environment: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" - container_image: "{{ docker_message_broker_image_full }}" - container_name: "rabbitmq" - container_volumes: - - "{{ node_config_directory }}/rabbitmq/:/opt/kolla/rabbitmq/:ro" - container_volumes_from: +- name: Starting RabbitMQ bootstrap 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 + image: "{{ rabbitmq_image_full }}" + volumes: "{{ node_config_directory }}/rabbitmq/:/opt/kolla/rabbitmq/:ro" + volumes_from: - "rabbitmq_data" + env: + KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"