repos

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
lint:
  enabled: false
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
- environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: fedora28
  image: fedora:28
  name: fedora28
  pkg_extras: python*-setuptools
provisioner:
  env:
    ANSIBLE_STDOUT_CALLBACK: yaml
  log: true
  name: ansible
scenario:
  test_sequence:
  - destroy
  - create
  - prepare
  - converge
  - verify
  - destroy
verifier:
  lint:
    name: flake8
  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
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.