From e46cf7c9889885a48720aafb2b66bc9a6750e55f Mon Sep 17 00:00:00 2001 From: Niklas Schwarz Date: Thu, 2 Nov 2023 09:05:21 +0100 Subject: [PATCH] Add ability to add custom configuration for RabbitMQ This implements a new variable rabbitmq_custom_config to be able to place custom configuration to the rabbitmq.conf e.g. to configure installed plugins Change-Id: I952eefe646b00f60184f8d353f6f055bbdc4ac90 --- defaults/main.yml | 2 ++ doc/source/configure-rabbitmq.rst | 14 ++++++++++++++ ...abbitmq_additional_config-8d5c0c0b6fc6d750.yaml | 4 ++++ templates/rabbitmq.conf.j2 | 8 ++++++++ 4 files changed, 28 insertions(+) create mode 100644 releasenotes/notes/rabbitmq_additional_config-8d5c0c0b6fc6d750.yaml diff --git a/defaults/main.yml b/defaults/main.yml index b3152019..6d0eb29c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -292,6 +292,8 @@ rabbitmq_port_bindings: tcp_listeners: "0.0.0.0": 5672 +rabbitmq_additional_config: {} + rabbitmq_init_overrides: Service: LimitNOFILE: "{{ rabbitmq_ulimit }}" diff --git a/doc/source/configure-rabbitmq.rst b/doc/source/configure-rabbitmq.rst index b8d2d24e..bc3cf217 100644 --- a/doc/source/configure-rabbitmq.rst +++ b/doc/source/configure-rabbitmq.rst @@ -34,3 +34,17 @@ between each OpenStack service and RabbitMQ. Setting this variable to ``false`` disables SSL encryption between OpenStack services and RabbitMQ and configures all services to use the plain text port, 5672. + +Add custom configuration to RabbitMQ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To add custom configuration, e.g. to configure installed plugins, +can be accomplished by defining a variable ``rabbitmq_additional_config`` +and add you configuration as a block to this variable. Make sure to +not add redundent configuration + +.. code-block:: yaml + + rabbitmq_additional_config: + prometheus.tcp.port: 15680 + prometheus.tcp.ip: 0.0.0.0 diff --git a/releasenotes/notes/rabbitmq_additional_config-8d5c0c0b6fc6d750.yaml b/releasenotes/notes/rabbitmq_additional_config-8d5c0c0b6fc6d750.yaml new file mode 100644 index 00000000..bf2389a8 --- /dev/null +++ b/releasenotes/notes/rabbitmq_additional_config-8d5c0c0b6fc6d750.yaml @@ -0,0 +1,4 @@ +--- +features: + - Add ``rabbitmq_additional_config`` to be able to add additional + configuration e.g. to add configuration for plugins. diff --git a/templates/rabbitmq.conf.j2 b/templates/rabbitmq.conf.j2 index 47c4f6ad..75a9e9a6 100644 --- a/templates/rabbitmq.conf.j2 +++ b/templates/rabbitmq.conf.j2 @@ -74,3 +74,11 @@ management.ssl.fail_if_no_peer_cert = {{ rabbitmq_ssl_fail_if_no_peer_cert | low management.tcp.ip = {{ rabbitmq_management_bind_address }} management.tcp.port = {{ rabbitmq_management_bind_tcp_port }} {% endif %} + +{% if rabbitmq_additional_config | length > 0 %} +# Custom configuration + +{% for config_key, config_value in rabbitmq_additional_config.items() %} +{{ config_key }} = {{ config_value }} +{% endfor %} +{% endif %}