30be04ea91
Add become to all tasks that use the module "kolla_docker" Change-Id: I4309c4011687b88ec31d739fd8f834fe2326ff10 Partial-Implements: blueprint ansible-specific-task-become
46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
---
|
|
- name: Checking if rabbitmq container needs upgrading
|
|
vars:
|
|
service_name: "rabbitmq"
|
|
service: "{{ rabbitmq_services[service_name] }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "compare_image"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ project_name }}"
|
|
image: "{{ rabbitmq_image_full }}"
|
|
environment: "{{ service.environment }}"
|
|
when: inventory_hostname in groups[role_rabbitmq_groups]
|
|
register: rabbitmq_differs
|
|
|
|
- include: config.yml
|
|
|
|
- name: Find gospel node
|
|
command: docker exec -t {{ project_name }} /usr/local/bin/rabbitmq_get_gospel_node
|
|
changed_when: gospel_node.stdout | from_json | changed
|
|
failed_when: gospel_node.stdout | from_json | failed
|
|
register: gospel_node
|
|
run_once: True
|
|
|
|
- name: Stopping non-gospel nodes
|
|
become: true
|
|
kolla_docker:
|
|
action: "stop_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ project_name }}"
|
|
when:
|
|
- rabbitmq_hostname != (gospel_node.stdout | from_json).hostname
|
|
- rabbitmq_differs['result']
|
|
|
|
- name: Flush handlers
|
|
meta: flush_handlers
|
|
when:
|
|
- rabbitmq_hostname == (gospel_node.stdout | from_json).hostname
|
|
- rabbitmq_differs['result']
|
|
|
|
- name: Flush handlers
|
|
meta: flush_handlers
|
|
when:
|
|
- rabbitmq_hostname != (gospel_node.stdout | from_json).hostname
|
|
- rabbitmq_differs['result']
|