parent
caf80bd161
commit
141904393a
2 changed files with 114 additions and 38 deletions
@ -1,4 +1,7 @@ |
||||
--- |
||||
repo_remi_release_uri: "http://rpms.remirepo.net/enterprise/remi-release-{{ ansible_distribution_major_version }}.rpm" |
||||
repo_postgres: True |
||||
# Only available for CentOS >= 8 |
||||
# if True, will switch to the CentOS Stream repo |
||||
repo_centos_stream: False |
||||
... |
||||
|
@ -1,44 +1,117 @@ |
||||
--- |
||||
- name: Configure base repositories |
||||
|
||||
- when: not repo_centos_stream |
||||
block: |
||||
- name: Configure repositories |
||||
yum_repository: |
||||
file: CentOS-Linux-{{ item.name }} |
||||
description: "Centos - {{ item.name }}" |
||||
name: "{{ item.name | lower }}" |
||||
baseurl: http://mirror.centos.org/$contentdir/$releasever/{{ item.repo }}/$basearch/os/ |
||||
file: "{{ item.file }}" |
||||
description: "CentOS {{ item.name }}" |
||||
name: "{{ item.name }}" |
||||
baseurl: http://mirror.centos.org/$contentdir/$releasever/{{ item.dir }}/$basearch/os/ |
||||
gpgcheck: True |
||||
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial |
||||
enabled: "{{ item.enabled | default(True) }}" |
||||
loop: |
||||
- name: BaseOS |
||||
repo: BaseOS |
||||
- name: AppStream |
||||
repo: AppStream |
||||
- name: PowerTools |
||||
repo: PowerTools |
||||
- name: Extras |
||||
repo: extras |
||||
- name: ContinuousRelease |
||||
repo: cr |
||||
enabled: False |
||||
- name: Plus |
||||
repo: centosplus |
||||
enabled: False |
||||
- name: FastTrack |
||||
repo: fasttrack |
||||
enabled: False |
||||
- name: baseos |
||||
file: CentOS-Linux-Base |
||||
dir: BaseOS |
||||
- name: appstream |
||||
file: CentOS-Linux-AppStream |
||||
dir: AppStream |
||||
- name: plus |
||||
file: CentOS-Linux-Plus |
||||
dir: centosplus |
||||
- name: extras |
||||
file: CentOS-Linux-Extras |
||||
dir: extras |
||||
- name: powertools |
||||
file: CentOS-Linux-PowerTools |
||||
dir: PowerTools |
||||
|
||||
- name: Remove Base file |
||||
file: path=/etc/yum.repos.d/{{ item }}.repo state=absent |
||||
loop: |
||||
- CentOS-Stream-AppStream |
||||
- CentOS-Stream-Base |
||||
- CentOS-Stream-ContinuousRelease |
||||
- CentOS-Stream-Debuginfo |
||||
- CentOS-Stream-Devel |
||||
- CentOS-Stream-Extras |
||||
- CentOS-Stream-FastTrack |
||||
- CentOS-Stream-centosplus |
||||
- CentOS-Stream-PowerTools |
||||
|
||||
# Waiting for the allowerasing args to dnf module, landing in ansible 2.10 |
||||
- name: Switch to centos-linux-repos |
||||
shell: rpm -q centos-linux-repos || dnf install centos-linux-repos -y --allowerasing |
||||
args: |
||||
warn: False |
||||
changed_when: False |
||||
|
||||
tags: repo |
||||
|
||||
- when: repo_centos_stream |
||||
block: |
||||
- name: Check if stream variable is set |
||||
copy: content={{ item.content }} dest={{ item.dest }} |
||||
loop: |
||||
- content: "{{ ansible_distribution_major_version }}-stream" |
||||
dest: /etc/dnf/vars/stream |
||||
|
||||
- name: Configure repositories |
||||
yum_repository: |
||||
file: "{{ item.file }}" |
||||
description: "CentOS {{ item.name }}" |
||||
name: "{{ item.name }}" |
||||
baseurl: http://mirror.centos.org/$contentdir/$stream/{{ item.dir }}/$basearch/os/ |
||||
gpgcheck: True |
||||
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial |
||||
loop: |
||||
- name: baseos |
||||
file: CentOS-Stream-BaseOS |
||||
dir: BaseOS |
||||
- name: appstream |
||||
file: CentOS-Stream-AppStream |
||||
dir: AppStream |
||||
- name: extras |
||||
file: CentOS-Stream-Extras |
||||
dir: extras |
||||
- name: powertools |
||||
file: CentOS-Stream-PowerTools |
||||
dir: PowerTools |
||||
|
||||
- name: Remove Base file |
||||
file: path=/etc/yum.repos.d/{{ item }}.repo state=absent |
||||
loop: |
||||
- CentOS-Base # Replaced with CentOS-BaseOS |
||||
- CentOS-CR # Replaced with CentOS-cr |
||||
- CentOS-Extras # Replaced with CentOS-extras |
||||
- CentOS-BaseOS # Replaced with CentOS-Linux-BaseOS |
||||
- CentOS-AppStream # Replaced with CentOS-Linux-AppStream |
||||
- CentOS-PowerTools # Replaced with CentOS-Linux-PowerTools |
||||
- CentOS-centosplus # Replaced with CentOS-Linux-Plus |
||||
- CentOS-cr # Replaced with CentOS-Linux-ContinuousRelease |
||||
- CentOS-extras # Replaced with CentOS-Linux-Extras |
||||
- CentOS-fasttrack # Replaced with CentOS-Linux-FastTrack |
||||
- CentOS-Linux-AppStream |
||||
- CentOS-Linux-BaseOS |
||||
- CentOS-Linux-ContinuousRelease |
||||
- CentOS-Linux-Debuginfo |
||||
- CentOS-Linux-Devel |
||||
- CentOS-Linux-Extras |
||||
- CentOS-Linux-FastTrack |
||||
- CentOS-Linux-centosplus |
||||
- CentOS-Linux-PowerTools |
||||
|
||||
# Waiting for the allowerasing args to dnf module, landing in ansible 2.10 |
||||
- name: Switch to centos-stream-repos |
||||
shell: rpm -q centos-stream-repos || dnf install centos-stream-repos -y --allowerasing |
||||
args: |
||||
warn: False |
||||
changed_when: False |
||||
|
||||
tags: repo |
||||
|
||||
- name: Remove old repo files |
||||
file: path=/etc/yum.repos.d/{{ item }}.repo state=absent |
||||
loop: |
||||
- CentOS-Base |
||||
- CentOS-CR |
||||
- CentOS-Extras |
||||
- CentOS-BaseOS |
||||
- CentOS-AppStream |
||||
- CentOS-PowerTools |
||||
- CentOS-centosplus |
||||
- CentOS-cr |
||||
- CentOS-extras |
||||
- CentOS-fasttrack |
||||
tags: repo |
||||
|
Loading…
Reference in new issue