---
- hosts: undercloud
  vars:
    metadata:
      name: Check the number of IP addresses available to 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
    ctlplane_iprange_min_size: 25
  tasks:
  - name: Get the path of tripleo undercloud config file
    become: true
    hiera: name="tripleo_undercloud_conf_file"
  - name: Gather undercloud.conf values
    become: true
    undercloud_conf: undercloud_conf_path={{ tripleo_undercloud_conf_file }}
  - name: Check the size of the DHCP range for overcloud nodes
    ip_range:
      start: "{{ undercloud_conf.DEFAULT.dhcp_start|default('192.0.2.5') }}"
      end: "{{ undercloud_conf.DEFAULT.dhcp_end|default('192.0.2.24') }}"
      min_size: "{{ ctlplane_iprange_min_size }}"
