main.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ---
  2. - fail:
  3. msg: 'Missing required private DNS server(s)'
  4. when:
  5. - external_nsupdate_keys['private'] is undefined
  6. - hostvars[groups['dns'][0]] is undefined
  7. - fail:
  8. msg: 'Missing required public DNS server(s)'
  9. when:
  10. - external_nsupdate_keys['public'] is undefined
  11. - hostvars[groups['dns'][0]] is undefined
  12. - name: "Set the private DNS server to use the external value (if provided)"
  13. set_fact:
  14. private_dns_server: "{{ external_nsupdate_keys['private']['server'] }}"
  15. when:
  16. - external_nsupdate_keys['private'] is defined
  17. - name: "Set the private DNS server to use the provisioned value"
  18. set_fact:
  19. private_dns_server: "{{ hostvars[groups['dns'][0]].private_v4 }}"
  20. when:
  21. - private_dns_server is undefined
  22. - name: "Set the public DNS server to use the external value (if provided)"
  23. set_fact:
  24. public_dns_server: "{{ external_nsupdate_keys['public']['server'] }}"
  25. when:
  26. - external_nsupdate_keys['public'] is defined
  27. - name: "Set the public DNS server to use the provisioned value"
  28. set_fact:
  29. public_dns_server: "{{ hostvars[groups['dns'][0]].public_v4 }}"
  30. when:
  31. - public_dns_server is undefined