1
0
Fork 0
forked from infra/ansible
ansible/tasks/yumrepos.yml

204 lines
7.7 KiB
YAML
Raw Permalink Normal View History

---
- name: Include vars/all/
include_vars:
dir: /srv/web/infra/ansible/vars/all/
ignore_files: [README]
tags:
- config
- packages
- yumrepos
- name: Enable repos for archived Fedora releases
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
- name: Put rhel repos on rhel systems
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"
when: ansible_distribution == 'RedHat' and not inventory_hostname.startswith('ppc9') and datacenter != "aws"
tags:
- config
- packages
- yumrepos
- name: Put rhel repos on rhel systems (power9)
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"
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
- name: Put epel repos on el systems
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"
tags:
- config
- packages
2014-09-30 00:03:50 +00:00
- yumrepos
- name: Put epel repos on el systems (aws)
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"
tags:
- config
- packages
- yumrepos
- name: Put epel gpg key on el systems (aws)
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"
tags:
- config
- packages
- yumrepos
- name: Epel release on el systems (aws)
ansible.builtin.package:
name: 'epel-release'
state: present
when: (((ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and ansible_distribution_major_version|int != 9) and use_default_epel) and datacenter == "aws"
tags:
- config
- packages
- yumrepos
- name: Put fedora repos on primary architecture systems
ansible.builtin.template: src="{{ files }}/common/{{ item }}" dest="/etc/yum.repos.d/{{ item }}"
with_items:
- fedora.repo
- fedora-updates.repo
- fedora-updates-testing.repo
when: ansible_distribution == 'Fedora' and ansible_architecture not in ['ppc64le', 's390x'] and datacenter != "aws"
tags:
- config
- packages
- yumrepos
- name: Put fedora repos on secondary architecture systems
ansible.builtin.template: src="{{ files }}/common/{{ item }}-secondary" dest="/etc/yum.repos.d/{{ item }}"
with_items:
- fedora.repo
- fedora-updates.repo
- fedora-updates-testing.repo
when: ansible_distribution == 'Fedora' and ansible_architecture in ['ppc64le', 's390x'] and datacenter != "aws"
tags:
- config
- packages
- yumrepos
- name: Add infrastructure tags repo - RHEL (8,9)
ansible.builtin.copy: src="{{ files }}/common/rhel-infra-tags.repo" dest="/etc/yum.repos.d/infra-tags.repo"
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int != 10
tags:
- config
- packages
- yumrepos
- name: Add infrastructure tags repo - RHEL (10+)
ansible.builtin.copy: src="{{ files }}/common/rhel-infra-tags-20260709.repo" dest="/etc/yum.repos.d/infra-tags.repo"
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 10
tags:
- config
- packages
- yumrepos
- name: Add infrastructure STAGING tags repo - RHEL (8,9)
ansible.builtin.copy: src="{{ files }}/common/rhel-infra-tags-stg.repo" dest="/etc/yum.repos.d/infra-tags-stg.repo"
when: (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int != 10) and env in ['staging', 'pagure-staging']
tags:
- config
- packages
- yumrepos
- name: Add infrastructure STAGING tags repo - RHEL (10+)
ansible.builtin.copy: src="{{ files }}/common/rhel-infra-tags-stg-20260709.repo" dest="/etc/yum.repos.d/infra-tags-stg.repo"
when: (ansible_distribution == 'RedHat' and ansible_distribution_major_version|int >= 10) and env in ['staging', 'pagure-staging']
tags:
- config
- packages
- yumrepos
- name: Add infrastructure tags repo - Fedora
ansible.builtin.copy: src="{{ files }}/common/fedora-infra-tags.repo" dest="/etc/yum.repos.d/infra-tags.repo"
when: ansible_distribution == 'Fedora'
tags:
- config
- packages
- yumrepos
- name: Add infrastructure STAGING tags repo - Fedora
ansible.builtin.copy: src="{{ files }}/common/fedora-infra-tags-stg.repo" dest="/etc/yum.repos.d/infra-tags-stg.repo"
when: ansible_distribution == 'Fedora' and env in ['staging', 'pagure-staging']
tags:
- config
- packages
- yumrepos
- name: Make sure older infrastructure tags repos no longer exist
ansible.builtin.file: path="/etc/yum.repos.d/{{item}}" state=absent
with_items:
- fedora-modular.repo
- fedora-updates-modular.repo
- fedora-updates-testing-modular.repo
- 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
# 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"
- name: Remove cisco repository to avoid issues with it, nothing in infra needs it
ansible.builtin.copy:
content: '# Unneeded, causes problems sometimes, and builders especially should use no external data'
dest: /etc/yum.repos.d/fedora-cisco-openh264.repo
when: "ansible_distribution == 'Fedora'"
- name: Put RabbitMQ CentOS-9 SIG repos on el systems
ansible.builtin.copy: src="{{ files }}/common/centos9s-rabbitmq38.repo" dest="/etc/yum.repos.d/centos9s-rabbitmq38.repo"
when: inventory_hostname.startswith('rabbitmq') and (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and ansible_distribution_major_version|int == 9
tags:
- config
- packages
- yumrepos
- name: Put RabbitMQ CentOS-9 SIG gpg key on el systems
ansible.builtin.copy: src="{{ files }}/common/RPM-GPG-KEY-CentOS-SIG-Messaging" dest="/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Messaging"
when: inventory_hostname.startswith('rabbitmq') and (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and ansible_distribution_major_version|int == 9
tags:
- config
- packages
- yumrepos