From b525bfebb76374eaa116f499adc99e50e0a8a78b Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 20 Feb 2024 16:04:10 -0600 Subject: [PATCH] Issue #158: Fix RHEL pubkey setup. --- tasks/setup-RedHat.yml | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index 50d5cb1..9dda2b6 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -1,36 +1,19 @@ --- -- name: Set up the Nodesource RPM directory. - set_fact: - nodejs_rhel_rpm_dir: "pub_{{ nodejs_version }}" - -- name: Import Nodesource RPM key (CentOS < 7). +- name: Import Nodesource RPM key. rpm_key: - key: http://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL - state: present - when: ansible_distribution_major_version | int < 7 - -- name: Import Nodesource RPM key (CentOS 7+). - rpm_key: - key: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL - state: present - when: ansible_distribution_major_version | int >= 7 - -- name: Add Nodesource repositories for Node.js (CentOS < 7). - yum: - name: "http://rpm.nodesource.com/{{ nodejs_rhel_rpm_dir }}/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm" + key: https://rpm.nodesource.com/gpgkey/nodesource.gpg.key state: present - when: ansible_distribution_major_version | int < 7 - register: node_repo -- name: Add Nodesource repositories for Node.js (CentOS 7+). +- name: Add Nodesource repositories for Node.js. yum: - name: "https://rpm.nodesource.com/{{ nodejs_rhel_rpm_dir }}/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm" + name: "https://rpm.nodesource.com/pub_{{ nodejs_version }}/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm" state: present when: ansible_distribution_major_version | int >= 7 register: node_repo - name: Update package cache if repo was added. - yum: update_cache=yes + yum: + update_cache: true when: node_repo is changed tags: ['skip_ansible_lint']