Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: "Register all VMs with DHCP"
- hosts: all
- gather_facts: false
- tags: config_vm
- serial: 1
- vars:
- iphost: "{{ip_static.IPAddress}}/{{ip_static.PrefixLength}}"
- netid: "{{iphost | ipaddr('network')}}"
- tasks:
- - name: "Add DHCP IP Reservation for VM"
- delegate_to: fj-v-dhcp1
- win_dsc5:
- resource_name: "xDhcpServerReservation"
- ScopeId: "{{ netid }}"
- ClientMacAddress: "{{ vmconfig.networks[0].mac | replace(':','') | replace('-','') }}"
- IPAddress: "{{ ip_static.IPAddress }}"
- item_name: "{{ inventory_hostname }}"
- AddressFamily: "IPv4"
- Ensure: "Present"
- when:
- - vmconfig is defined
- - ip_static is defined
- - inventory_hostname != "fj-v-dhcp1"
- - vmconfig.networks[0] is defined
- - vmconfig.networks[0].mac is defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement