ctlplane_ip_range

Role Documentation

Welcome to the “ctlplane_ip_range” role documentation.

Role Defaults

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

ctlplane_iprange_min_size: 20

Role Variables: main.yml

metadata:
  name: Check the number of IP addresses available for the overcloud nodes
  description: >
    Verify that the number of IP addresses defined in `dhcp_start` and
    `dhcp_end` fields in `undercloud.conf` is not too low.
  groups:
  - pre-introspection

Molecule Scenarios

Molecule is being used to test the “ctlplane_ip_range” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.

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
- name: Converge
  hosts: all
  gather_facts: false
  tasks:
  - name: Ensure we get needed facts
    setup:
      gather_subset:
      - '!all'
      - '!any'
      - '!min'
      - env

  - name: Test good values
    block:
    - name: populate undercloud.conf with right range length
      copy:
        dest: '{{ ansible_env.HOME }}/undercloud.conf'
        content: |
          [ctlplane-subnet]
          dhcp_start = 192.168.12.10
          dhcp_end = 192.168.12.100
    - include_role:
        name: ctlplane_ip_range

  - name: Test failing
    block:
    - name: populate undercloud.conf with wrong range length
      copy:
        dest: '{{ ansible_env.HOME }}/undercloud.conf'
        content: |
          [ctlplane-subnet]
          dhcp_start = 192.168.12.10
          dhcp_end = 192.168.12.20
    - include_role:
        name: ctlplane_ip_range
    rescue:
    - name: Clear host errors
      meta: clear_host_errors

    - debug:
        msg: The validation works! End the playbook run

    - name: End play
      meta: end_play

  - name: Fail the test
    fail:
      msg: |
        The ctlplane-ip-range validation didn't properly detect too short
        range!