kolla-ansible/ansible/roles/ironic/tasks/precheck.yml
Maksim Malchuk 762aecbfae Multiple DHCP ranges for Ironic Inspector
Add a new parameter 'ironic_dnsmasq_dhcp_ranges' and enable the
configuration of the corresponding 'dhcp-range' and 'dhcp-option'
blocks in Ironic Inspector dnsmasq for multiple ranges.

The old parameters 'ironic_dnsmasq_dhcp_range' and
'ironic_dnsmasq_default_gateway' used for the only range are now
removed.

This change implements the same solution used in the TripleO several
years ago in the: Ie49b07ffe948576f5d9330cf11ee014aef4b282d

Also, this change contains: Iae15e9db0acc2ecd5b087a9ca430be948bc3e649
fix for lease time.
The value can be changed globally or per range.

Change-Id: Ib69fc0017b3bfbc8da4dfd4301710fbf88be661a
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com>
2022-04-13 19:26:31 +00:00

78 lines
2.2 KiB
YAML

---
- import_role:
name: service-precheck
vars:
service_precheck_services: "{{ ironic_services }}"
service_name: "{{ project_name }}"
- name: Get container facts
become: true
kolla_container_facts:
name:
- ironic_api
- ironic_inspector
# TODO(yoctozepto): Remove ironic_ipxe entry in Zed.
- ironic_ipxe
- ironic_http
register: container_facts
- name: Checking free port for Ironic API
wait_for:
host: "{{ api_interface_address }}"
port: "{{ ironic_api_listen_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- container_facts['ironic_api'] is not defined
- inventory_hostname in groups['ironic-api']
- name: Checking free port for Ironic Inspector
wait_for:
host: "{{ api_interface_address }}"
port: "{{ ironic_inspector_listen_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- container_facts['ironic_inspector'] is not defined
- inventory_hostname in groups['ironic-inspector']
- name: Checking free port for Ironic HTTP server
wait_for:
host: "{{ api_interface_address }}"
port: "{{ ironic_http_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
# TODO(yoctozepto): Remove ironic_ipxe entry in Zed.
- container_facts['ironic_ipxe'] is not defined
- container_facts['ironic_http'] is not defined
- inventory_hostname in groups['ironic-http']
- name: Checking ironic-agent files exist for Ironic Inspector
stat:
path: "{{ node_custom_config }}/ironic/{{ item }}"
delegate_to: localhost
run_once: True
register: result
failed_when: not result.stat.exists
when:
# Only required when Ironic inspector is in use.
- groups['ironic-inspector'] | length > 0
- (not ironic_dnsmasq_serve_ipxe | bool and inventory_hostname in groups['ironic-tftp']) or
(ironic_dnsmasq_serve_ipxe | bool and inventory_hostname in groups['ironic-http'])
- not enable_ironic_pxe_uefi | bool
with_items:
- "ironic-agent.kernel"
- "ironic-agent.initramfs"
- name: Ensure ironic_dnsmasq_dhcp_ranges is configured
fail:
msg: >
ironic_dnsmasq_dhcp_ranges must be a list
connection: local
run_once: True
when: not ironic_dnsmasq_dhcp_ranges is sequence