repos¶
An Ansible role to check the correctness of current repositories.
Requirements¶
This role could be used before/after an Undercloud or an Overcloud has been deployed.
Role Variables¶
None
Dependencies¶
No dependencies.
Example Playbook¶
- hosts: undercloud
roles:
- role: repos
- hosts: overcloud
roles:
- role: repos
License¶
Apache
Author Information¶
Red Hat TripleO Validations Team
Role Documentation¶
Welcome to the “repos” role documentation.
Role Variables: main.yml¶
metadata:
name: Check correctness of current repositories
description: >
Detect whether the repositories listed in `yum repolist`
can be connected to and that there is at least one repo
configured.
Detect if there are any unwanted repositories (such as EPEL) enabled.
groups:
- pre-upgrade
Molecule Scenarios¶
Molecule is being used to test the “repos” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.
- Driver: podman:
Scenario: default¶
Molecule Platform(s)¶
- name: centos
hostname: centos
image: centos/centos:stream8
registry:
url: quay.io
dockerfile: ../../../../.config/molecule/Dockerfile
pkg_extras: python*-setuptools python*-pyyaml
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
privileged: true
environment:
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
ulimits:
- host
Molecule Inventory¶
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
Example default playbook¶
- name: Converge
hosts: all
tasks:
- name: test role without failure
include_role:
name: repos
- name: run with failure
block:
- name: inject faulty repository
yum_repository:
name: faulty
description: really faulty repository
baseurl: http://this.repository.do-not.exists/like-not-at-all
enabled: true
- name: execute role
include_role:
name: repos
rescue:
- name: clean host error
meta: clear_host_errors
- name: Molecule output
debug:
msg: Successfully detected first broken repository
- name: run with another failure
block:
- name: remove faulty repository
yum_repository:
name: faulty
state: absent
- name: push another faulty repository with working DNS
yum_repository:
name: faulty-bis
description: faulty repository with working DNS
baseurl: http://download.fedoraproject.org/pub/fedora/blah
enabled: true
- name: execute role
include_role:
name: repos
rescue:
- name: clean host error
meta: clear_host_errors
- name: Molecule output
debug:
msg: Successfully detected second faulty repository. Exiting!
- name: End play
meta: end_play
- name: Fail the test
fail:
msg: |
The repos validation failed detecting broken/non-working repository