---
- name: Validate required configuration
  ansible.builtin.fail:
    msg: |
      Missing required configuration for {{ inventory_hostname }}:
      {% if dns_servers is not defined or dns_servers | length == 0 %}
      - dns_servers must be defined in inventory with at least one DNS server
      {% endif %}
      {% if worker_ip is not defined %}
      - worker_ip must be defined
      {% endif %}
      {% if worker_gateway is not defined %}
      - worker_gateway must be defined
      {% endif %}
      {% if worker_netmask is not defined %}
      - worker_netmask must be defined
      {% endif %}
      {% if network_interface is not defined %}
      - network_interface must be defined
      {% endif %}
  when: >
    dns_servers is not defined or dns_servers | length == 0 or
    worker_ip is not defined or
    worker_gateway is not defined or
    worker_netmask is not defined or
    network_interface is not defined

- name: Setup boot infrastructure
  ansible.builtin.include_tasks: setup_boot_infrastructure.yaml

- name: Prepare RHEL boot files
  ansible.builtin.include_tasks: prepare_rhel_boot_files.yaml

- name: Configure LPAR for RHEL boot
  ansible.builtin.include_tasks: configure_rhel_lpar.yaml