check_undercloud_conf

Role Documentation

Welcome to the “check_undercloud_conf” role documentation.

Role Defaults

This section highlights all of the defaults and variables set within the “check_undercloud_conf” role.

check_undercloud_conf_debug: false
deprecated_params:
- masquerade_network
- docker_images_file
- enabled_drivers
- docker_bip
- network_gateway
- network_cidr
- discovery_interface
- discovery_runbench
- docker_insecure_registries
- docker_registry_mirror
- ipxe_enabled
required_params:
- container_images_file
unsupported_drivers:
- pxe_ipmitool
- pxe_drac
- pxe_ilo
- pxe_irmc
- fake_pxe

Molecule Scenarios

Molecule is being used to test the “check_undercloud_conf” 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: podman
log: true
platforms:
- dockerfile: ../../../../.config/molecule/Dockerfile
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos
  image: centos/centos:stream8
  name: centos
  pkg_extras: python*-setuptools python*-pyyaml
  privileged: true
  registry:
    url: quay.io
  ulimits:
  - host
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
  env:
    ANSIBLE_LIBRARY: ${ANSIBLE_LIBRARY:-/usr/share/ansible/plugins/modules}
    ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles
    ANSIBLE_STDOUT_CALLBACK: yaml
  inventory:
    hosts:
      all:
        hosts:
          centos:
            ansible_python_interpreter: /usr/bin/python3
  log: true
  name: ansible
  options:
    vvv: true
scenario:
  test_sequence:
  - destroy
  - create
  - prepare
  - converge
  - verify
  - destroy
verifier:
  name: ansible
Molecule Inventory
hosts:
  all:
    hosts:
      centos:
        ansible_python_interpreter: /usr/bin/python3
Example default playbook
- gather_facts: false
  hosts: all
  name: Converge
  tasks:
  - block:
    - include_role:
        name: check_undercloud_conf
      name: run validation check_undercloud_conf
    name: detect non existing file assigned to a parameter
    rescue:
    - meta: clear_host_errors
      name: Clear host errors
    - fail:
        msg: 'Test failed due to wrong error: {{ ansible_failed_result.results.0.msg
          }}'
      name: Detect right error message
      when:
      - not ansible_failed_result.results.0.msg | regex_search("^File configured in
        .* does not exist$")
    - debug:
        msg: Detected undercloud.conf configuration issue!
      name: Status message
    - meta: end_play
      name: End play
  - fail:
      msg: 'A configuration issue should have been detected but it wasn''t..

        '
    name: Fail the test

Scenario: required_missing

Example required_missing configuration
driver:
  name: podman
log: true
platforms:
- dockerfile: ../../../../.config/molecule/Dockerfile
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos
  image: centos/centos:stream8
  name: centos
  pkg_extras: python*-setuptools python*-pyyaml
  privileged: true
  registry:
    url: quay.io
  ulimits:
  - host
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
  env:
    ANSIBLE_LIBRARY: ${ANSIBLE_LIBRARY:-/usr/share/ansible/plugins/modules}
    ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles
    ANSIBLE_STDOUT_CALLBACK: yaml
  inventory:
    hosts:
      all:
        hosts:
          centos:
            ansible_python_interpreter: /usr/bin/python3
  log: true
  name: ansible
  options:
    vvv: true
scenario:
  test_sequence:
  - destroy
  - create
  - prepare
  - converge
  - verify
  - destroy
verifier:
  name: ansible
Molecule Inventory
hosts:
  all:
    hosts:
      centos:
        ansible_python_interpreter: /usr/bin/python3
Example required_missing playbook
- gather_facts: false
  hosts: all
  name: Converge
  tasks:
  - block:
    - include_role:
        name: check_undercloud_conf
      name: run validation check_undercloud_conf
    name: detect missing required parameter from conf
    rescue:
    - meta: clear_host_errors
      name: Clear host errors
    - fail:
        msg: 'Test failed due to wrong error: {{ ansible_failed_result.results.0.msg
          }}'
      name: Detect right error message
      when:
      - not ansible_failed_result.results.0.msg | regex_search("^Property .* is required
        in .*$")
    - debug:
        msg: Detected undercloud.conf configuration issue!
      name: Status message
    - meta: end_play
      name: End play
  - fail:
      msg: 'A configuration issue should have been detected but it wasn''t..

        '
    name: Fail the test

Scenario: deprecated_params

Example deprecated_params configuration
driver:
  name: podman
log: true
platforms:
- dockerfile: ../../../../.config/molecule/Dockerfile
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos
  image: centos/centos:stream8
  name: centos
  pkg_extras: python*-setuptools python*-pyyaml
  privileged: true
  registry:
    url: quay.io
  ulimits:
  - host
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
  env:
    ANSIBLE_LIBRARY: ${ANSIBLE_LIBRARY:-/usr/share/ansible/plugins/modules}
    ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles
    ANSIBLE_STDOUT_CALLBACK: yaml
  inventory:
    hosts:
      all:
        hosts:
          centos:
            ansible_python_interpreter: /usr/bin/python3
  log: true
  name: ansible
  options:
    vvv: true
scenario:
  test_sequence:
  - destroy
  - create
  - prepare
  - converge
  - verify
  - destroy
verifier:
  name: ansible
Molecule Inventory
hosts:
  all:
    hosts:
      centos:
        ansible_python_interpreter: /usr/bin/python3
Example deprecated_params playbook
- gather_facts: false
  hosts: all
  name: Converge
  tasks:
  - block:
    - include_role:
        name: check_undercloud_conf
      name: run validation check_undercloud_conf
    name: detect deprecated parameters in undercloud conf
    rescue:
    - meta: clear_host_errors
      name: Clear host errors
    - fail:
        msg: 'Test failed due to wrong error: {{ ansible_failed_result.msg }}'
      name: Detect right error message
      when:
      - not ansible_failed_result.msg | regex_search("^Parameters .* are deprecated
        for .*$")
    - debug:
        msg: Detected undercloud.conf configuration issue!
      name: Status message
    - meta: end_play
      name: End play
  - fail:
      msg: 'A configuration issue should have been detected but it wasn''t..

        '
    name: Fail the test

Scenario: config_OK

Example config_OK configuration
driver:
  name: podman
log: true
platforms:
- dockerfile: ../../../../.config/molecule/Dockerfile
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos
  image: centos/centos:stream8
  name: centos
  pkg_extras: python*-setuptools python*-pyyaml
  privileged: true
  registry:
    url: quay.io
  ulimits:
  - host
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
  env:
    ANSIBLE_LIBRARY: ${ANSIBLE_LIBRARY:-/usr/share/ansible/plugins/modules}
    ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles
    ANSIBLE_STDOUT_CALLBACK: yaml
  inventory:
    hosts:
      all:
        hosts:
          centos:
            ansible_python_interpreter: /usr/bin/python3
  log: true
  name: ansible
  options:
    vvv: true
scenario:
  test_sequence:
  - destroy
  - create
  - prepare
  - converge
  - verify
  - destroy
verifier:
  name: ansible
Molecule Inventory
hosts:
  all:
    hosts:
      centos:
        ansible_python_interpreter: /usr/bin/python3
Example config_OK playbook
- gather_facts: false
  hosts: all
  name: Converge
  roles:
  - role: check_undercloud_conf

Scenario: deprecated_drivers

Example deprecated_drivers configuration
driver:
  name: podman
log: true
platforms:
- dockerfile: ../../../../.config/molecule/Dockerfile
  environment:
    http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
    https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
  hostname: centos
  image: centos/centos:stream8
  name: centos
  pkg_extras: python*-setuptools python*-pyyaml
  privileged: true
  registry:
    url: quay.io
  ulimits:
  - host
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
  env:
    ANSIBLE_LIBRARY: ${ANSIBLE_LIBRARY:-/usr/share/ansible/plugins/modules}
    ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles
    ANSIBLE_STDOUT_CALLBACK: yaml
  inventory:
    hosts:
      all:
        hosts:
          centos:
            ansible_python_interpreter: /usr/bin/python3
  log: true
  name: ansible
  options:
    vvv: true
scenario:
  test_sequence:
  - destroy
  - create
  - prepare
  - converge
  - verify
  - destroy
verifier:
  name: ansible
Molecule Inventory
hosts:
  all:
    hosts:
      centos:
        ansible_python_interpreter: /usr/bin/python3
Example deprecated_drivers playbook
- gather_facts: false
  hosts: all
  name: Converge
  tasks:
  - block:
    - include_role:
        name: check_undercloud_conf
      name: run validation check_undercloud_conf
    name: detect deprecated parameters in undercloud conf
    rescue:
    - meta: clear_host_errors
      name: Clear host errors
    - fail:
        msg: 'Test failed due to wrong error: {{ ansible_failed_result.msg }}'
      name: Detect right error message
      when:
      - not ansible_failed_result.msg | regex_search("^Hardware type\\(s\\) .* are
        not supported any more$")
    - debug:
        msg: Detected undercloud.conf configuration issue!
      name: Status message
    - meta: end_play
      name: End play
  - fail:
      msg: 'A configuration issue should have been detected but it wasn''t..

        '
    name: Fail the test