Make Rabbitmq config files overridable

Rabbitmq config files can be overrided in node_custom_config directory.

Change-Id: Id724b44a3edd951fa8b06c9f2c347e9ed8c5ffd9
Closes-Bug: #1674446
This commit is contained in:
Benjamin Diaz 2017-11-27 16:45:12 -03:00
parent 404d0b1c12
commit 0729472256
2 changed files with 53 additions and 10 deletions

View File

@ -52,5 +52,7 @@
- inventory_hostname != groups[service.group]|first
- service.enabled | bool
- config_json.changed | bool
or rabbitmq_confs.changed | bool
or rabbitmq_env_conf.changed | bool
or rabbitmq_config.changed | bool
or rabbitmq_definitions.changed | bool
or rabbitmq_container.changed | bool

View File

@ -27,22 +27,63 @@
- Restart rabbitmq container (first node)
- Restart rabbitmq container (rest of nodes)
- name: Copying over rabbitmq configs
- name: Copying over rabbitmq-env.conf
become: true
vars:
service: "{{ rabbitmq_services['rabbitmq'] }}"
template:
src: "{{ item }}.j2"
dest: "{{ node_config_directory }}/{{ project_name }}/{{ item }}"
src: "{{ item }}"
dest: "{{ node_config_directory }}/{{ project_name }}/rabbitmq-env.conf"
mode: "0770"
become: true
register: rabbitmq_confs
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
with_items:
- "rabbitmq-env.conf"
- "rabbitmq.conf"
- "definitions.json"
notify:
- Restart rabbitmq container (first node)
- Restart rabbitmq container (rest of nodes)