2
0
Fork 0

manage redhat's mess with repository names

names differ between RedHat 8, CentOS 8.2, CentOS 8.3+...
This commit is contained in:
Mathieu Jourdan 2021-05-11 17:01:28 +02:00
parent 2bb3055502
commit 0f0be2616c
5 changed files with 53 additions and 12 deletions

View File

@ -13,11 +13,26 @@
name: "{{ fusioninventory__repo_package }}" name: "{{ fusioninventory__repo_package }}"
state: present state: present
- name: Enable PowerTools Repository - name: RedHat 8 specifics
ini_file: block:
path: "{{ fusioninventory__powertools_repo_file }}"
section: "{{ item.section }}" - name: Load additional repository settings for CentOS or RedHat 8
option: "{{ item.option }}" include_vars: "{{ item }}"
value: "{{ item.value }}" with_first_found:
loop: "{{ fusioninventory__powertools_repo_params }}" - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- name: Override repository settings for CentOS <= 8.2
include_vars: "CentOS-8.2.yml"
when:
- ansible_facts['distribution'] == "CentOS"
- ansible_facts['distribution_version'] | float <= 8.2
- name: Enable Additional Repository
ini_file:
path: "{{ fusioninventory__additional_repo_file }}"
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
loop: "{{ fusioninventory__additional_repo_params }}"
when: ansible_facts['distribution_major_version'] | int >= 8 when: ansible_facts['distribution_major_version'] | int >= 8

10
vars/CentOS-8.2.yml Normal file
View File

@ -0,0 +1,10 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# For CentOS Linux 8.2 and below
# https://wiki.centos.org/Manuals/ReleaseNotes/CentOS8.2011#Yum_repo_file_and_repoid_changes
fusioninventory__additional_repo_file: "/etc/yum.repos.d/{{ ansible_distribution }}-PowerTools.repo"
fusioninventory__additional_repo_params:
- section: PowerTools
option: enabled
value: "1"

10
vars/CentOS-8.yml Normal file
View File

@ -0,0 +1,10 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# For CentOS Linux 8.3 and above
# https://wiki.centos.org/Manuals/ReleaseNotes/CentOS8.2011#Yum_repo_file_and_repoid_changes
fusioninventory__additional_repo_file: "/etc/yum.repos.d/{{ ansible_distribution }}-Linux-PowerTools.repo"
fusioninventory__additional_repo_params:
- section: powertools
option: enabled
value: "1"

10
vars/RedHat-8.yml Normal file
View File

@ -0,0 +1,10 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# For RedHat Entreprise Linux 8
# https://developers.redhat.com/blog/2018/11/15/introducing-codeready-linux-builder/
fusioninventory__additionnal_repo_file: "/etc/yum.repos.d/redhat.repo"
fusioninventory__additionnal_repo_params:
- section: codeready-builder-for-rhel-8-x86_64-rpms
option: enabled
value: "1"

View File

@ -13,8 +13,4 @@ fusioninventory__agent_packages:
fusioninventory__repo_package: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" fusioninventory__repo_package: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
fusioninventory__repo_gpgkey: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" fusioninventory__repo_gpgkey: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"
fusioninventory__powertools_repo_file: "/etc/yum.repos.d/{{ ansible_distribution }}-PowerTools.repo"
fusioninventory__powertools_repo_params:
- section: PowerTools
option: enabled
value: "1"