repos

Role Documentation

Welcome to the “repos” role documentation.

Role Variables: main.yml

metadata:
  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
  name: Check correctness of current repositories

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.

Scenario: default

Example default configuration
driver:
  name: docker
log: true
platforms:
- easy_install:
  - pip
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos7
  image: centos:7
  name: centos7
  pkg_extras: python-setuptools
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos8
  image: centos:8
  name: centos8
  pkg_extras: python*-setuptools
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
  env:
    ANSIBLE_STDOUT_CALLBACK: yaml
  log: true
  name: ansible
scenario:
  test_sequence:
  - destroy
  - create
  - prepare
  - converge
  - verify
  - destroy
verifier:
  name: testinfra
Example default playbook
- hosts: all
  name: Converge
  tasks:
  - include_role:
      name: repos
    name: test role without failure
  - block:
    - name: inject faulty repository
      yum_repository:
        baseurl: http://this.repository.do-not.exists/like-not-at-all
        description: really faulty repository
        enabled: true
        name: faulty
    - include_role:
        name: repos
      name: execute role
    name: run with failure
    rescue:
    - meta: clear_host_errors
      name: clean host error
    - debug:
        msg: Successfully detected first broken repository
      name: Molecule output
  - block:
    - name: remove faulty repository
      yum_repository:
        name: faulty
        state: absent
    - name: push another faulty repository with working DNS
      yum_repository:
        baseurl: http://download.fedoraproject.org/pub/fedora/blah
        description: faulty repository with working DNS
        enabled: true
        name: faulty-bis
    - include_role:
        name: repos
      name: execute role
    name: run with another failure
    rescue:
    - meta: clear_host_errors
      name: clean host error
    - debug:
        msg: Successfully detected second faulty repository. Exiting!
      name: Molecule output
    - meta: end_play
      name: End play
  - fail:
      msg: 'The repos validation failed detecting broken/non-working repository

        '
    name: Fail the test