Improve handling of rabbitmq_install_method changing

Instead of using a conditional block, use the "state" parameter
of the yum_repository module to ensure that the repo
config is correctly added/removed if rabbitmq_install_method is
changed after initial deployment.

Change-Id: Ief07a74cd0019fefd58e27fb8dc4299b99299f99
This commit is contained in:
Jonathan Rosser
2024-09-04 09:39:28 +01:00
parent e9de2b505d
commit c785927306
2 changed files with 3 additions and 2 deletions

View File

@@ -28,11 +28,10 @@
baseurl: "{{ item.baseurl }}" baseurl: "{{ item.baseurl }}"
gpgcheck: "{{ item.gpgcheck | default('no') }}" gpgcheck: "{{ item.gpgcheck | default('no') }}"
gpgkey: "{{ item.gpgkey | default(omit) }}" gpgkey: "{{ item.gpgkey | default(omit) }}"
state: "{{ item.state | default(omit) }}"
with_items: with_items:
- "{{ rabbitmq_erlang_repo }}" - "{{ rabbitmq_erlang_repo }}"
- "{{ rabbitmq_repo }}" - "{{ rabbitmq_repo }}"
when:
- rabbitmq_install_method == 'external_repo'
tags: tags:
- rabbitmq-repos - rabbitmq-repos

View File

@@ -29,6 +29,7 @@ _rabbitmq_repo:
description: "RabbitMQ Server Rolling Repository" description: "RabbitMQ Server Rolling Repository"
baseurl: "{{ rabbitmq_repo_url }}" baseurl: "{{ rabbitmq_repo_url }}"
filename: RabbitMQ filename: RabbitMQ
state: "{{ (rabbitmq_install_method == 'external_repo') | ternary('present', 'absent') }}"
gpgcheck: yes gpgcheck: yes
gpgkey: gpgkey:
- https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc - https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
@@ -41,6 +42,7 @@ _rabbitmq_erlang_repo:
description: "RabbitMQ Erlang Packages" description: "RabbitMQ Erlang Packages"
baseurl: "{{ rabbitmq_erlang_repo_url }}" baseurl: "{{ rabbitmq_erlang_repo_url }}"
filename: els-erlang filename: els-erlang
state: "{{ (rabbitmq_erlang_install_method == 'external_repo') | ternary('present', 'absent') }}"
gpgcheck: yes gpgcheck: yes
gpgkey: gpgkey:
- https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key - https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key