From a0452bf4f9627b93dce7504efa22202fdb12b86d Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Sat, 22 Apr 2023 00:57:00 -0700 Subject: [PATCH] use crb handlers --- handlers/main.yml | 4 ++++ role-rocky-mqtt.yml | 32 ++++++-------------------------- role-rocky-rabbitmq.yml | 39 ++++++++++----------------------------- 3 files changed, 20 insertions(+), 55 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 7a099c2..7473183 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -56,4 +56,8 @@ ansible.builtin.service: name: rsyncd state: restarted + +- name: enable_crb + ansible.builtin.shell: "set -o pipefail && /usr/bin/crb enable" + changed_when: "1 != 1" ... diff --git a/role-rocky-mqtt.yml b/role-rocky-mqtt.yml index 74a0229..0a0e787 100644 --- a/role-rocky-mqtt.yml +++ b/role-rocky-mqtt.yml @@ -4,8 +4,8 @@ hosts: all become: true vars_files: + - vars/mqtt.yml # vars/vaults/encpass.yml - - vars/mqtt.yml # This is to try to avoid the handler issue in pre/post tasks handlers: @@ -24,38 +24,18 @@ success_msg: "We are able to run on this node" fail_msg: "/etc/no-ansible exists - skipping run on this node" - # EPEL and PowerTools are required for ipsilon to function - # I also couldn't find an ansible built-in to do this - - name: Enable the PowerTools repository - community.general.ini_file: - dest: /etc/yum.repos.d/Rocky-PowerTools.repo - section: powertools - option: enabled - value: 1 - owner: root - group: root - mode: '0644' - when: ansible_distribution_major_version == "8" - - - name: Enable the CRB repository - community.general.ini_file: - dest: /etc/yum.repos.d/Rocky-CRB.repo - section: crb - option: enabled - value: 1 - owner: root - group: root - mode: '0644' - when: ansible_distribution_major_version == "9" - - # The CentOS extras repos has epel-release provided - name: Enable the EPEL repository ansible.builtin.dnf: name: epel-release state: present + notify: + - enable_crb tags: - packages + - name: Flush handlers + ansible.builtin.meta: flush_handlers + roles: - role: rockylinux.ipagetcert state: present diff --git a/role-rocky-rabbitmq.yml b/role-rocky-rabbitmq.yml index 962c740..05247a1 100644 --- a/role-rocky-rabbitmq.yml +++ b/role-rocky-rabbitmq.yml @@ -4,9 +4,9 @@ hosts: all become: true vars_files: - - vars/common.yml - # vars/vaults/encpass.yml - - vars/rabbitmq.yml + # vars/vaults/encpass.yml + - vars/common.yml + - vars/rabbitmq.yml # This is to try to avoid the handler issue in pre/post tasks handlers: @@ -27,41 +27,22 @@ # We have separate passwords per rabbitmq env - name: Import rabbitmq passwords - include_vars: + ansible.builtin.include_vars: file: "vars/vaults/rabbitmq_{{ rabbitmq_env }}.yml" - # EPEL and PowerTools are required for ipsilon to function - # I also couldn't find an ansible built-in to do this - - name: Enable the PowerTools repository - community.general.ini_file: - dest: /etc/yum.repos.d/Rocky-PowerTools.repo - section: powertools - option: enabled - value: 1 - owner: root - group: root - mode: '0644' - when: ansible_distribution_major_version == "8" - - - name: Enable the CRB repository - community.general.ini_file: - dest: /etc/yum.repos.d/Rocky-CRB.repo - section: crb - option: enabled - value: 1 - owner: root - group: root - mode: '0644' - when: ansible_distribution_major_version == "9" - # The extras repos has epel-release provided - name: Enable the EPEL repository - dnf: + ansible.builtin.dnf: name: epel-release state: present + notify: + - enable_crb tags: - packages + - name: Flush handlers + ansible.builtin.meta: flush_handlers + # This will change eventually to a rocky-release-messaging repo or to a # rocky-release-rabbitmq repo #- name: Install centos rabbitmq