kolla-ansible/ansible/roles/rabbitmq/tasks/config.yml
Benjamin Diaz 0729472256 Make Rabbitmq config files overridable
Rabbitmq config files can be overrided in node_custom_config directory.

Change-Id: Id724b44a3edd951fa8b06c9f2c347e9ed8c5ffd9
Closes-Bug: #1674446
2018-12-14 12:28:31 -03:00

110 lines
3.4 KiB
YAML

---
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ project_name }}"
state: "directory"
owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}"
mode: "0770"
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ rabbitmq_services }}"
- name: Copying over config.json files for services
template:
src: "{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ project_name }}/config.json"
mode: "0770"
become: true
register: rabbitmq_config_jsons
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ rabbitmq_services }}"
notify:
- Restart rabbitmq container (first node)
- Restart rabbitmq container (rest of nodes)
- name: Copying over rabbitmq-env.conf
become: true
vars:
service: "{{ rabbitmq_services['rabbitmq'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/{{ project_name }}/rabbitmq-env.conf"
mode: "0770"
with_first_found:
- "{{ node_custom_config }}/rabbitmq/{{ inventory_hostname }}/rabbitmq-env.conf"
- "{{ node_custom_config }}/rabbitmq/rabbitmq-env.conf"
- "rabbitmq-env.conf.j2"
register: rabbitmq_env_conf
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart rabbitmq container (first node)
- Restart rabbitmq container (rest of nodes)
- name: Copying over rabbitmq.conf
become: true
vars:
service: "{{ rabbitmq_services['rabbitmq'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/{{ project_name }}/rabbitmq.conf"
mode: "0770"
with_first_found:
- "{{ node_custom_config }}/rabbitmq/{{ inventory_hostname }}/rabbitmq.conf"
- "{{ node_custom_config }}/rabbitmq/rabbitmq.conf"
- "rabbitmq.conf.j2"
register: rabbitmq_config
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart rabbitmq container (first node)
- Restart rabbitmq container (rest of nodes)
- name: Copying over definitions.json
become: true
vars:
service: "{{ rabbitmq_services['rabbitmq'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/{{ project_name }}/definitions.json"
mode: "0770"
with_first_found:
- "{{ node_custom_config }}/rabbitmq/{{ inventory_hostname }}/definitions.json"
- "{{ node_custom_config }}/rabbitmq/definitions.json"
- "definitions.json.j2"
register: rabbitmq_definitions
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart rabbitmq container (first node)
- Restart rabbitmq container (rest of nodes)
- name: Check rabbitmq containers
become: true
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes }}"
environment: "{{ item.value.environment }}"
dimensions: "{{ item.value.dimensions }}"
register: check_rabbitmq_containers
when:
- kolla_action != "config"
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ rabbitmq_services }}"
notify:
- Restart rabbitmq container (first node)
- Restart rabbitmq container (rest of nodes)