diff --git a/ansible/roles/common/tasks/config.yml b/ansible/roles/common/tasks/config.yml index fabcd1d70a..c2878cc246 100644 --- a/ansible/roles/common/tasks/config.yml +++ b/ansible/roles/common/tasks/config.yml @@ -275,26 +275,29 @@ with_dict: "{{ common_services }}" - name: Copy rabbitmq-env.conf to kolla toolbox - copy: - content: | - RABBITMQ_CTL_ERL_ARGS="-proto_dist inet6_tcp" - export ERL_INETRC=/etc/rabbitmq/erl_inetrc + template: + src: "{{ item }}" dest: "{{ node_config_directory }}/kolla-toolbox/rabbitmq-env.conf" mode: "0600" + with_first_found: + - "{{ node_custom_config }}/kolla-toolbox/{{ inventory_hostname }}/rabbitmq-env.conf" + - "{{ node_custom_config }}/kolla-toolbox/rabbitmq-env.conf" + - "rabbitmq-env.conf.j2" become: true when: - common_services['kolla-toolbox'] | service_enabled_and_mapped_to_host - enable_rabbitmq | bool - - api_address_family == "ipv6" -- name: Copy rabbitmq erl_intr to kolla toolbox - copy: - content: | - {inet6,true}. +- name: Copy rabbitmq erl_inetrc to kolla toolbox + template: + src: "{{ item }}" dest: "{{ node_config_directory }}/kolla-toolbox/erl_inetrc" mode: "0600" become: true + with_first_found: + - "{{ node_custom_config }}/kolla-toolbox/{{ inventory_hostname }}/erl_inetrc" + - "{{ node_custom_config }}/kolla-toolbox/erl_inetrc" + - "erl_inetrc.j2" when: - common_services['kolla-toolbox'] | service_enabled_and_mapped_to_host - enable_rabbitmq | bool - - api_address_family == "ipv6" diff --git a/ansible/roles/common/templates/erl_inetrc.j2 b/ansible/roles/common/templates/erl_inetrc.j2 new file mode 100644 index 0000000000..81755d8a3f --- /dev/null +++ b/ansible/roles/common/templates/erl_inetrc.j2 @@ -0,0 +1,3 @@ +{% if api_address_family == 'ipv6' %} +{inet6,true}. +{% endif %} diff --git a/ansible/roles/common/templates/kolla-toolbox.json.j2 b/ansible/roles/common/templates/kolla-toolbox.json.j2 index 3936f002f3..f075ffd79d 100644 --- a/ansible/roles/common/templates/kolla-toolbox.json.j2 +++ b/ansible/roles/common/templates/kolla-toolbox.json.j2 @@ -6,7 +6,7 @@ "dest": "/var/lib/rabbitmq/.erlang.cookie", "owner": "rabbitmq", "perm": "0600" - }{% if api_address_family == 'ipv6' %}, + }, { "source": "{{ container_config_directory }}/rabbitmq-env.conf", "dest": "/etc/rabbitmq/rabbitmq-env.conf", @@ -18,7 +18,7 @@ "dest": "/etc/rabbitmq/erl_inetrc", "owner": "rabbitmq", "perm": "0600" - }{% endif %}{% endif %} + }{% endif %} ], "permissions": [ { diff --git a/ansible/roles/common/templates/rabbitmq-env.conf.j2 b/ansible/roles/common/templates/rabbitmq-env.conf.j2 new file mode 100644 index 0000000000..b78696a209 --- /dev/null +++ b/ansible/roles/common/templates/rabbitmq-env.conf.j2 @@ -0,0 +1,2 @@ +RABBITMQ_CTL_ERL_ARGS="{% if api_address_family == 'ipv6' %}-proto_dist inet6_tcp {% endif %}" +export ERL_INETRC=/etc/rabbitmq/erl_inetrc diff --git a/releasenotes/notes/override-rmq-in-ktb-86c97926db67d3c9.yaml b/releasenotes/notes/override-rmq-in-ktb-86c97926db67d3c9.yaml new file mode 100644 index 0000000000..202044efb9 --- /dev/null +++ b/releasenotes/notes/override-rmq-in-ktb-86c97926db67d3c9.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added support to override rabbitmq config (``erl_inetrc`` and + ``rabbitmq-env.conf``) in the ``kolla-toolbox`` container.