Seed Inventory

Seed Inventory #

Before any host can be PXE booted, its definition must exist in the Ansible inventory. MAC addresses, IP assignments, DNS records, and DHCP reservations are all driven from host_vars.

Repository: ansible-inventory-deevnet


When This Is Required #

ScenarioAction
Capacity expansionAdd host to hosts.yml, create new host_vars/<hostname>.yml
Hardware replacementUpdate MAC address in existing host_vars/<hostname>.yml
Greenfield buildAll hosts need both steps

Inventory Structure #

ansible-inventory-deevnet/
└── mobile/
    ├── hosts.yml           # Main inventory (hosts and group memberships)
    ├── group_vars/         # Variables by group
    └── host_vars/          # Per-host variables (MAC, IP, DNS, DHCP)
        ├── dv02hyp001p01.yml
        ├── dv02hyp002p02.yml
        └── ...

Adding a New Host (Expansion) #

1. Add to hosts.yml #

Add the hostname to appropriate groups:

hypervisors:
  hosts:
    dv02hyp001p01: {}
    dv02hyp002p02: {}
    dv02hyp003p01: {}    # new host

2. Create host_vars file #

Create host_vars/<hostname>.yml with infrastructure and environment data:

infrastructure:
  form: hv
  interfaces:
    eth0:
      mac: "aa:bb:cc:dd:ee:ff"

env:
  interfaces:
    eth0:
      ip: 192.168.10.23
      purpose: mgmt
      segment: management
      dns:
        host_a_record: true
        dhcp_reservation: true
        cnames:
          - dv02hyp003p01

3. Apply configuration #

cd ~/home/ansible-collection-deevnet.builder
make rebuild
ansible-playbook playbooks/site.yml --limit bootstrap_nodes

This generates PXE configs and pushes DNS/DHCP to Core Router.


Updating for Hardware Replacement #

When replacing hardware (new NIC = new MAC address), update the existing host_vars file:

infrastructure:
  interfaces:
    eth0:
      mac: "d8:9e:f3:7d:94:c4"   # updated MAC, read off the new NIC

Then apply configuration as above.


Management-Plane VMs Are Different #

Everything above assumes a MAC is a hardware fact you can read off a NIC. A management-plane VM has no NIC to read until something creates one, so its MAC is derived from its Proxmox VMID and written into inventory by a tool rather than typed in by hand.

Such a host uses a host_vars directory, with the generated values in their own file:

mobile/host_vars/dv02tdn001v01/
├── vars.yml       # hand-written
└── identity.yml   # GENERATED - do not edit

vars.yml references the generated values and defaults them, so the file parses before an identity exists:

infrastructure:
  form: vm
  interfaces:
    eth0:
      mac: "{{ deevnet_assigned_mac | default('') }}"

mgmt_vm:
  vmid: "{{ deevnet_assigned_vmid | default(0) }}"

Then allocate the identity, which writes identity.yml:

cd ~/home/ansible-collection-deevnet.mgmt
make vm-identity-assign

Full procedure, including why allocation must precede the DHCP reservation and the VM’s first boot: Allocate VM Identity.


Host Variables Reference #

PathPurpose
infrastructure.formDevice type (hv, rt, sw, ap, etc.)
infrastructure.interfaces.<iface>.macMAC address
mgmt_vm.vmidProxmox VMID (management-plane VMs only; source of the MAC)
env.interfaces.<iface>.ipIP address (or dhcp)
env.interfaces.<iface>.segmentNetwork segment name
env.interfaces.<iface>.dns.host_a_recordCreate DNS A record
env.interfaces.<iface>.dns.dhcp_reservationCreate DHCP reservation
env.interfaces.<iface>.dns.cnamesList of CNAME aliases
Page last modified: September 9, 2026