kolla-ansible/ansible/roles/rabbitmq/tasks/config.yml
Mark Goddard a4bb8567da Fix up config file permissions on the host
Several config file permissions are incorrect on the host. In general,
files should be 0660, and directories and executables 0770.

Change-Id: Id276ac1864f280554e98b937f2845bb424d521de
Closes-Bug: #1821579
2019-04-02 17:23:31 +01:00

105 lines
3.2 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: "0660"
become: true
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: "0660"
with_first_found:
- "{{ node_custom_config }}/rabbitmq/{{ inventory_hostname }}/rabbitmq-env.conf"
- "{{ node_custom_config }}/rabbitmq/rabbitmq-env.conf"
- "rabbitmq-env.conf.j2"
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: "0660"
with_first_found:
- "{{ node_custom_config }}/rabbitmq/{{ inventory_hostname }}/rabbitmq.conf"
- "{{ node_custom_config }}/rabbitmq/rabbitmq.conf"
- "rabbitmq.conf.j2"
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: "0660"
with_first_found:
- "{{ node_custom_config }}/rabbitmq/{{ inventory_hostname }}/definitions.json"
- "{{ node_custom_config }}/rabbitmq/definitions.json"
- "definitions.json.j2"
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 }}"
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)