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.

# All variables intended for modification should place placed in this file.

# All variables within this role should have a prefix of "check_undercloud_conf"
check_undercloud_conf_debug: false
required_params:
- container_images_file
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
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: deprecated_drivers

Driver: podman:
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 deprecated_drivers playbook
# Validate that the validation fails when the undercloud.conf contains
# deprecated drivers in the enabled_hardware_types:
#
# [DEFAULT]
# local_interface = em0
# local_ip = 192.168.24.1/24
# undercloud_public_host = 192.168.24.2
# undercloud_admin_host = 192.168.24.3
# undercloud_nameservers = 172.16.0.1,10.0.0.1
# undercloud_ntp_servers=clock1.rdu2.redhat.com
# overcloud_domain_name=redhat.local
# undercloud_service_certificate = /undercloud.pem
# hieradata_override = /hiera_override.yaml
# container_images_file= /containers-prepare-parameter.yaml
# enabled_hardware_types = pxe_ipmitool,pxe_drac,fake_pxe,ipmi,redfish
# custom_env_files = /skip_rhel_release.yaml
#
# [ctlplane-subnet]
# local_subnet = ctlplane-subnet
# cidr = 192.168.24.0/24
# dhcp_start = 192.168.24.5
# dhcp_end = 192.168.24.55
# gateway = 192.168.24.1
# inspection_iprange = 192.168.24.100,192.168.24.120
#
- name: Converge
  hosts: all
  gather_facts: false
  tasks:
  - name: detect deprecated parameters in undercloud conf
    block:
    - name: run validation check_undercloud_conf
      include_role:
        name: check_undercloud_conf
    rescue:
    - name: Clear host errors
      meta: clear_host_errors

    - name: Detect right error message
      fail:
        msg: 'Test failed due to wrong error: {{ ansible_failed_result.msg }}'
      when:
      - not ansible_failed_result.msg | regex_search("^Hardware type\\(s\\) .* are
        not supported any more$")

    - name: Status message
      debug:
        msg: Detected undercloud.conf configuration issue!

    - name: End play
      meta: end_play

  - name: Fail the test
    fail:
      msg: |
        A configuration issue should have been detected but it wasn't..

Scenario: required_missing

Driver: podman:
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 required_missing playbook
# Validate that the validation fails when the undercloud.conf does not contain
# a required parameter. In this case, container_images_file:
#
# [DEFAULT]
# local_interface = em0
# local_ip = 192.168.24.1/24
# undercloud_public_host = 192.168.24.2
# undercloud_admin_host = 192.168.24.3
# undercloud_nameservers = 172.16.0.1,10.0.0.1
# undercloud_ntp_servers=clock1.rdu2.redhat.com
# overcloud_domain_name=redhat.local
# undercloud_service_certificate = /undercloud.pem
# hieradata_override = /hiera_override.yaml
# enabled_hardware_types = ipmi,redfish
# custom_env_files = /skip_rhel_release.yaml
#
# [ctlplane-subnet]
# local_subnet = ctlplane-subnet
# cidr = 192.168.24.0/24
# dhcp_start = 192.168.24.5
# dhcp_end = 192.168.24.55
# gateway = 192.168.24.1
# inspection_iprange = 192.168.24.100,192.168.24.120
#
- name: Converge
  hosts: all
  gather_facts: false
  tasks:
  - name: detect missing required parameter from conf
    block:
    - name: run validation check_undercloud_conf
      include_role:
        name: check_undercloud_conf
    rescue:
    - name: Clear host errors
      meta: clear_host_errors

    - name: Detect right error message
      fail:
        msg: 'Test failed due to wrong error: {{ ansible_failed_result.results.0.msg
          }}'
      when:
      - not ansible_failed_result.results.0.msg | regex_search("^Property .* is required
        in .*$")

    - name: Status message
      debug:
        msg: Detected undercloud.conf configuration issue!

    - name: End play
      meta: end_play

  - name: Fail the test
    fail:
      msg: |
        A configuration issue should have been detected but it wasn't..

Scenario: default

Driver: podman:
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
# Validate an undercloud.conf with the following content:
#
# [DEFAULT]
# container_images_file= /home/stack/containers-prepare-parameter.yaml
#
# The validation should fail as the file /home/stack/containers-prepare-parameter.yaml
# does not exist.

- name: Converge
  hosts: all
  gather_facts: false
  tasks:
  - name: detect non existing file assigned to a parameter
    block:
    - name: run validation check_undercloud_conf
      include_role:
        name: check_undercloud_conf
    rescue:
    - name: Clear host errors
      meta: clear_host_errors

    - name: Detect right error message
      fail:
        msg: 'Test failed due to wrong error: {{ ansible_failed_result.results.0.msg
          }}'
      when:
      - not ansible_failed_result.results.0.msg | regex_search("^File configured in
        .* does not exist$")

    - name: Status message
      debug:
        msg: Detected undercloud.conf configuration issue!

    - name: End play
      meta: end_play

  - name: Fail the test
    fail:
      msg: |
        A configuration issue should have been detected but it wasn't..

Scenario: config_OK

Driver: podman:
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 config_OK playbook
# Validate a correct undercloud.conf with content:
#
# [DEFAULT]
# local_interface = em0
# local_ip = 192.168.24.1/24
# undercloud_public_host = 192.168.24.2
# undercloud_admin_host = 192.168.24.3
# undercloud_nameservers = 172.16.0.1,10.0.0.1
# undercloud_ntp_servers=clock1.rdu2.redhat.com
# overcloud_domain_name=redhat.local
# undercloud_service_certificate = /undercloud.pem
# hieradata_override = /hiera_override.yaml
# container_images_file= /containers-prepare-parameter.yaml
# enabled_hw_types = ipmi,redfish
# custom_env_files = /skip_rhel_release.yaml
#
# [ctlplane-subnet]
# local_subnet = ctlplane-subnet
# cidr = 192.168.24.0/24
# dhcp_start = 192.168.24.5
# dhcp_end = 192.168.24.55
# gateway = 192.168.24.1
# inspection_iprange = 192.168.24.100,192.168.24.120
#
- name: Converge
  hosts: all
  gather_facts: false
  roles:
  - role: check_undercloud_conf

Scenario: deprecated_params

Driver: podman:
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 deprecated_params playbook
# Validate that the validation fails when undercloud.conf contains
# deprecated parameters:
#
#
# [DEFAULT]
# container_images_file= /containers-prepare-parameter.yaml
# enabled_drivers = ipxe
# masquerade_network=192.168.24.0/24
# ipxe_enabled = true
# docker_insecure_registries =  'docker.io'
# custom_env_files = /skip_rhel_release.yaml
# network_cidr = 192.168.24.0/24
# network_gateway =192.168.24.1
#
- name: Converge
  hosts: all
  gather_facts: false
  tasks:
  - name: detect deprecated parameters in undercloud conf
    block:
    - name: run validation check_undercloud_conf
      include_role:
        name: check_undercloud_conf
    rescue:
    - name: Clear host errors
      meta: clear_host_errors

    - name: Detect right error message
      fail:
        msg: 'Test failed due to wrong error: {{ ansible_failed_result.msg }}'
      when:
      - not ansible_failed_result.msg | regex_search("^Parameters .* are deprecated
        for .*$")

    - name: Status message
      debug:
        msg: Detected undercloud.conf configuration issue!

    - name: End play
      meta: end_play

  - name: Fail the test
    fail:
      msg: |
        A configuration issue should have been detected but it wasn't..