Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. - name: "Register all VMs with DHCP"
  2. hosts: all
  3. gather_facts: false
  4. tags: config_vm
  5. serial: 1
  6. vars:
  7. iphost: "{{ip_static.IPAddress}}/{{ip_static.PrefixLength}}"
  8. netid: "{{iphost | ipaddr('network')}}"
  9. tasks:
  10. - name: "Add DHCP IP Reservation for VM"
  11. delegate_to: fj-v-dhcp1
  12. win_dsc5:
  13. resource_name: "xDhcpServerReservation"
  14. ScopeId: "{{ netid }}"
  15. ClientMacAddress: "{{ vmconfig.networks[0].mac | replace(':','') | replace('-','') }}"
  16. IPAddress: "{{ ip_static.IPAddress }}"
  17. item_name: "{{ inventory_hostname }}"
  18. AddressFamily: "IPv4"
  19. Ensure: "Present"
  20. when:
  21. - vmconfig is defined
  22. - ip_static is defined
  23. - inventory_hostname != "fj-v-dhcp1"
  24. - vmconfig.networks[0] is defined
  25. - vmconfig.networks[0].mac is defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement