|
@@ -1,21 +1,13 @@
|
|
|
---
|
|
|
-- name: Enable crb on CentOS 9
|
|
|
+- name: Enable crb on CentOS
|
|
|
shell:
|
|
|
cmd: dnf config-manager --set-enabled crb
|
|
|
changed_when: false
|
|
|
when:
|
|
|
- ansible_distribution == "CentOS"
|
|
|
- - ansible_distribution_major_version == "9"
|
|
|
|
|
|
-- name: Enable EPEL Repo on CentOS 7/8
|
|
|
- package:
|
|
|
- name: epel-release
|
|
|
- state: present
|
|
|
- when:
|
|
|
- - ansible_distribution == "CentOS"
|
|
|
- - ansible_distribution_major_version|int > 9
|
|
|
|
|
|
-- name: Check for EPEL Repo on CentOS 9
|
|
|
+- name: Check for EPEL Repo on CentOS
|
|
|
shell:
|
|
|
cmd: rpm -q epel-release
|
|
|
changed_when: false
|
|
@@ -23,28 +15,29 @@
|
|
|
register: epel_check
|
|
|
when:
|
|
|
- ansible_distribution == "CentOS"
|
|
|
- - ansible_distribution_major_version == "9"
|
|
|
|
|
|
-- name: Enable EPEL Repo on CentOS 9
|
|
|
+
|
|
|
+- name: Query latest EPEL RPM File
|
|
|
+ shell:
|
|
|
+ cmd: curl -s https://dl.fedoraproject.org/pub/epel/{{ ansible_distribution_major_version }}/Everything/x86_64/Packages/e/ | grep epel-release | tail -n1 | grep -oP 'href="\K[^"]+'
|
|
|
+ changed_when: false
|
|
|
+ failed_when: false
|
|
|
+ register: epel_rpm
|
|
|
+ when:
|
|
|
+ - ansible_distribution == "CentOS"
|
|
|
+ - epel_check.rc|int == 1
|
|
|
+
|
|
|
+
|
|
|
+- name: Enable EPEL Repo on CentOS 9+
|
|
|
dnf:
|
|
|
name:
|
|
|
- - https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/e/epel-release-9-4.el9.noarch.rpm
|
|
|
- - https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/e/epel-next-release-9-4.el9.noarch.rpm
|
|
|
+ - https://dl.fedoraproject.org/pub/epel/{{ ansible_distribution_major_version }}/Everything/x86_64/Packages/e/{{ epel_rpm.stdout }}
|
|
|
state: present
|
|
|
disable_gpg_check: yes
|
|
|
when:
|
|
|
- ansible_distribution == "CentOS"
|
|
|
- - ansible_distribution_major_version == "9"
|
|
|
- epel_check.rc|int == 1
|
|
|
|
|
|
-- name: Enable PowerTools on CentOS 8
|
|
|
- lineinfile:
|
|
|
- path: /etc/yum.repos.d/CentOS-{% if ansible_lsb.id == 'CentOSStream' %}Stream-{% endif %}PowerTools.repo
|
|
|
- regexp: '^enabled='
|
|
|
- line: 'enabled=1'
|
|
|
- when:
|
|
|
- - ansible_distribution == 'CentOS'
|
|
|
- - ansible_distribution_major_version == "8"
|
|
|
|
|
|
- name: Check for RPMFusion rpms
|
|
|
shell:
|
|
@@ -68,7 +61,6 @@
|
|
|
register: rpmfusion_repos
|
|
|
when:
|
|
|
- ansible_distribution == 'CentOS' or ansible_distribution == 'Fedora'
|
|
|
- - ansible_distribution_major_version != "9" # no RPMFusion yet for CentOS Stream 9
|
|
|
- rpmfusion_check.rc != "0"
|
|
|
|
|
|
|
|
@@ -83,7 +75,6 @@
|
|
|
- rpmfusion_repos is defined
|
|
|
- rpmfusion_repos.changed
|
|
|
- ansible_distribution == 'CentOS' or ansible_distribution == 'Fedora'
|
|
|
- - ansible_distribution_major_version != "9" # no RPMFusion yet for CentOS Stream 9
|
|
|
|
|
|
|
|
|
- name: Combine Packages (RPM)
|
|
@@ -98,6 +89,7 @@
|
|
|
when:
|
|
|
- ansible_distribution == 'CentOS' or ansible_distribution == 'Fedora'
|
|
|
|
|
|
+
|
|
|
- name: Combine Packages (DEB)
|
|
|
set_fact:
|
|
|
all_pkgs: "{{ all_pkgs | default([]) | union(item) }}"
|
|
@@ -108,6 +100,7 @@
|
|
|
when:
|
|
|
- ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
|
|
|
|
|
|
+
|
|
|
- name: Install packages
|
|
|
package:
|
|
|
name: "{{ all_pkgs }}"
|
|
@@ -115,6 +108,7 @@
|
|
|
when:
|
|
|
- all_pkgs is defined
|
|
|
|
|
|
+
|
|
|
- name: Install ansible SSH keys
|
|
|
authorized_key:
|
|
|
user: ansible
|