---
- name: Ensure IP addresses are allocated
  vars:
    # NOTE(mgoddard): Use the Python interpreter used to run ansible-playbook,
    # since this has Python dependencies available to it (PyYAML).
    ansible_python_interpreter: "{{ ansible_playbook_python }}"
  delegate_to: localhost
  ip_allocation:
    allocation_file: "{{ ip_allocation_filename }}"
    hostname: "{{ ip_allocation_hostname }}"
    net_name: "{{ item.net_name }}"
    cidr: "{{ item.cidr }}"
    allocation_pool_start: "{{ item.allocation_pool_start | default(omit) }}"
    allocation_pool_end: "{{ item.allocation_pool_end | default(omit) }}"
  with_items: "{{ ip_allocations }}"
