2013-05-20 17:14:56 +00:00
---
2019-12-16 11:58:07 +01:00
- name : Include vars/all/
include_vars :
dir : /srv/web/infra/ansible/vars/all/
ignore_files : [ README]
2019-12-16 12:01:51 +01:00
tags :
- config
- packages
- yumrepos
2019-12-16 11:58:07 +01:00
2025-01-14 20:18:57 +10:00
- name : Enable repos for archived Fedora releases
2021-03-10 15:24:23 +01:00
set_fact :
archive_if_archived : >-
{{
'/archive'
if ansible_distribution_major_version|int < (
FedoraPreviousPreviousCycleNumber|int
if FedoraPreviousPrevious == True
else FedoraPreviousCycleNumber|int
)
else ''
}}
when : ansible_distribution == 'Fedora'
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Put rhel repos on rhel systems
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/rhel{{ ansible_distribution_major_version|int }}.repo" dest="/etc/yum.repos.d/rhel{{ ansible_distribution_major_version|int }}.repo"
2020-02-25 20:21:45 +00:00
when : ansible_distribution == 'RedHat' and not inventory_hostname.startswith('ppc9') and datacenter != "aws"
2019-03-22 04:36:31 +00:00
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Put rhel repos on rhel systems (power9)
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/rhel{{ ansible_distribution_major_version|int }}-power9.repo" dest="/etc/yum.repos.d/rhel{{ ansible_distribution_major_version|int }}.repo"
2020-02-25 20:21:45 +00:00
when : ansible_distribution == 'RedHat' and inventory_hostname.startswith('ppc9') and datacenter != "aws"
2014-06-20 23:18:51 +00:00
tags :
- config
- packages
2014-09-30 00:03:50 +00:00
- yumrepos
2014-06-20 23:18:51 +00:00
2025-01-14 20:18:57 +10:00
- name : Put epel repos on el systems
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/epel{{ ansible_distribution_major_version|int }}.repo" dest="/etc/yum.repos.d/epel{{ ansible_distribution_major_version|int }}.repo"
2021-03-15 21:03:08 +01:00
when : ((ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and use_default_epel) and datacenter != "aws"
2013-05-20 17:14:56 +00:00
tags :
- config
- packages
2014-09-30 00:03:50 +00:00
- yumrepos
2013-05-20 17:14:56 +00:00
2025-01-14 20:18:57 +10:00
- name : Put epel repos on el systems (aws)
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/original-epel{{ ansible_distribution_major_version|int }}.repo" dest="/etc/yum.repos.d/epel{{ ansible_distribution_major_version|int }}.repo"
2021-03-15 21:05:27 +01:00
when : ((ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and use_default_epel) and datacenter == "aws"
2021-03-15 20:53:40 +01:00
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Put epel gpg key on el systems (aws)
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version|int }}" dest="/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version|int }}"
2021-03-15 21:05:27 +01:00
when : ((ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and use_default_epel) and datacenter == "aws"
2021-03-15 20:53:40 +01:00
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Epel release on el systems (aws)
2024-12-19 13:22:42 +10:00
ansible.builtin.package :
2021-03-15 20:53:40 +01:00
name : 'epel-release'
state : present
2021-12-21 16:42:42 +00:00
when : (((ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and ansible_distribution_major_version|int != 9) and use_default_epel) and datacenter == "aws"
2021-03-15 20:53:40 +01:00
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Put fedora repos on primary architecture systems
2025-01-13 12:24:19 +10:00
ansible.builtin.template : src="{{ files }}/common/{{ item }}" dest="/etc/yum.repos.d/{{ item }}"
2013-09-05 02:11:53 +00:00
with_items :
- fedora.repo
- fedora-updates.repo
- fedora-updates-testing.repo
2024-02-13 06:23:29 +01:00
when : ansible_distribution == 'Fedora' and ansible_architecture not in ['ppc64le', 's390x'] and datacenter != "aws"
2018-11-20 20:13:37 +00:00
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Put fedora repos on secondary architecture systems
2025-01-13 12:24:19 +10:00
ansible.builtin.template : src="{{ files }}/common/{{ item }}-secondary" dest="/etc/yum.repos.d/{{ item }}"
2015-03-24 22:12:02 +00:00
with_items :
- fedora.repo
- fedora-updates.repo
- fedora-updates-testing.repo
2024-02-13 06:23:29 +01:00
when : ansible_distribution == 'Fedora' and ansible_architecture in ['ppc64le', 's390x'] and datacenter != "aws"
2017-06-20 22:52:56 +00:00
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Add infrastructure tags repo - RHEL
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/rhel-infra-tags.repo" dest="/etc/yum.repos.d/infra-tags.repo"
2025-05-30 19:29:26 -07:00
when : ((ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and ansible_distribution_major_version|int < 10)
2016-09-25 17:08:37 +00:00
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Add infrastructure STAGING tags repo - RHEL
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/rhel-infra-tags-stg.repo" dest="/etc/yum.repos.d/infra-tags-stg.repo"
2025-05-30 19:29:26 -07:00
when : (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and env in ['staging', 'pagure-staging'] and ansible_distribution_major_version|int < 10
2017-02-16 19:53:14 +00:00
tags :
- config
- packages
- yumrepos
2025-01-14 20:18:57 +10:00
- name : Add infrastructure tags repo - Fedora
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/fedora-infra-tags.repo" dest="/etc/yum.repos.d/infra-tags.repo"
2019-10-19 18:05:23 +00:00
when : ansible_distribution == 'Fedora'
2016-09-25 17:08:37 +00:00
tags :
- config
- packages
- yumrepos
2017-02-16 19:53:14 +00:00
2025-01-14 20:18:57 +10:00
- name : Add infrastructure STAGING tags repo - Fedora
2024-12-18 08:23:28 +10:00
ansible.builtin.copy : src="{{ files }}/common/fedora-infra-tags-stg.repo" dest="/etc/yum.repos.d/infra-tags-stg.repo"
2017-10-11 21:28:12 +02:00
when : ansible_distribution == 'Fedora' and env in ['staging', 'pagure-staging']
2017-02-16 19:53:14 +00:00
tags :
- config
- packages
- yumrepos
2017-08-02 08:54:05 +00:00
- name : Make sure older infrastructure tags repos no longer exist
2024-12-17 15:31:55 +10:00
ansible.builtin.file : path="/etc/yum.repos.d/{{item}}" state=absent
2017-08-02 08:54:05 +00:00
with_items :
2023-08-19 13:46:57 -07:00
- fedora-modular.repo
- fedora-updates-modular.repo
- fedora-updates-testing-modular.repo
2017-08-02 08:54:05 +00:00
- fedora-infra-tags.repo
- fedora-infra-tags-stg.repo
- rhel-infra-tags.repo
- rhel-infra-tags-stg.repo
- infrastructure.repo
- infrastructure-testing.repo
tags :
- config
- packages
- yumrepos
2024-11-22 11:06:09 -08:00
# when batcave01 is on a newer ansible we won't need python3-dnf but
# we *will* need python3-rpm (package_facts fails without it)
- name : Ensure that python3-dnf is installed (needed till ansible on batcave01 supports dnf5)
when : "ansible_distribution == 'Fedora' and ansible_distribution_major_version|int > 40 and ansible_cmdline.ostree is not defined"
block :
- name : Check whether python3-dnf is installed
ansible.builtin.command : "rpm -q python3-dnf"
register : p3dnf
failed_when : "1 != 1"
changed_when : "1 != 1"
check_mode : no
- name : Install python3-dnf with direct dnf command
ansible.builtin.command : "dnf -y install python3-dnf"
when : "p3dnf.rc != 0"