populate-dns.yml 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ---
  2. - name: Add private node records
  3. nsupdate:
  4. key_name: "{{ openshift_openstack_external_nsupdate_keys['private']['key_name'] }}"
  5. key_secret: "{{ openshift_openstack_external_nsupdate_keys['private']['key_secret'] }}"
  6. key_algorithm: "{{ openshift_openstack_external_nsupdate_keys['private']['key_algorithm'] | lower }}"
  7. server: "{{ openshift_openstack_external_nsupdate_keys['private']['server'] }}"
  8. zone: "{{ openshift_openstack_nsupdate_zone }}"
  9. record: "{{ hostvars[item]['ansible_hostname'] + openshift_openstack_private_hostname_suffix + '.' + openshift_openstack_full_dns_domain | replace('.' + openshift_openstack_nsupdate_zone, '') }}"
  10. value: "{{ hostvars[item]['private_v4'] }}"
  11. type: "A"
  12. state: "{{ l_dns_record_state | default('present') }}"
  13. with_items: "{{ l_openshift_openstack_dns_update_nodes }}"
  14. register: nsupdate_add_result
  15. until: nsupdate_add_result is succeeded
  16. retries: 10
  17. when:
  18. - openshift_openstack_external_nsupdate_keys['private'] is defined
  19. - hostvars[item]['private_v4'] is defined
  20. - hostvars[item]['private_v4'] is not none
  21. - hostvars[item]['private_v4'] | string
  22. delay: 1
  23. - name: Add public node records
  24. nsupdate:
  25. key_name: "{{ openshift_openstack_external_nsupdate_keys['public']['key_name'] }}"
  26. key_secret: "{{ openshift_openstack_external_nsupdate_keys['public']['key_secret'] }}"
  27. key_algorithm: "{{ openshift_openstack_external_nsupdate_keys['public']['key_algorithm'] | lower }}"
  28. server: "{{ openshift_openstack_external_nsupdate_keys['public']['server'] }}"
  29. zone: "{{ openshift_openstack_nsupdate_zone }}"
  30. record: "{{ hostvars[item]['ansible_hostname'] + openshift_openstack_public_hostname_suffix + '.' + openshift_openstack_full_dns_domain | replace('.' + openshift_openstack_nsupdate_zone, '') }}"
  31. value: "{{ hostvars[item]['public_v4'] }}"
  32. type: "A"
  33. state: "{{ l_dns_record_state | default('present') }}"
  34. with_items: "{{ l_openshift_openstack_dns_update_nodes }}"
  35. register: nsupdate_add_result
  36. until: nsupdate_add_result is succeeded
  37. retries: 10
  38. when:
  39. - openshift_openstack_external_nsupdate_keys['public'] is defined
  40. - hostvars[item]['public_v4'] is defined
  41. - hostvars[item]['public_v4'] is not none
  42. - hostvars[item]['public_v4'] | string
  43. delay: 1
  44. - name: Add public wildcard record
  45. nsupdate:
  46. key_name: "{{ openshift_openstack_external_nsupdate_keys['public']['key_name'] }}"
  47. key_secret: "{{ openshift_openstack_external_nsupdate_keys['public']['key_secret'] }}"
  48. key_algorithm: "{{ openshift_openstack_external_nsupdate_keys['public']['key_algorithm'] | lower }}"
  49. server: "{{ openshift_openstack_external_nsupdate_keys['public']['server'] }}"
  50. zone: "{{ openshift_openstack_nsupdate_zone }}"
  51. record: "{{ '*.' + hostvars[groups.masters[0]].openshift_master_default_subdomain | replace('.' + openshift_openstack_nsupdate_zone, '') }}"
  52. value: "{{ openshift_openstack_public_router_ip }}"
  53. type: "A"
  54. state: "{{ l_dns_record_state | default('present') }}"
  55. register: nsupdate_add_result
  56. until: nsupdate_add_result is succeeded
  57. retries: 10
  58. delay: 1
  59. when:
  60. - openshift_openstack_external_nsupdate_keys['public'] is defined
  61. - groups.masters
  62. - hostvars[groups.masters[0]].openshift_master_default_subdomain is defined
  63. - openshift_openstack_public_router_ip is defined
  64. - openshift_openstack_public_router_ip is not none
  65. - openshift_openstack_public_router_ip | string
  66. - name: Add public API record
  67. nsupdate:
  68. key_name: "{{ openshift_openstack_external_nsupdate_keys['public']['key_name'] }}"
  69. key_secret: "{{ openshift_openstack_external_nsupdate_keys['public']['key_secret'] }}"
  70. key_algorithm: "{{ openshift_openstack_external_nsupdate_keys['public']['key_algorithm'] | lower }}"
  71. server: "{{ openshift_openstack_external_nsupdate_keys['public']['server'] }}"
  72. zone: "{{ openshift_openstack_nsupdate_zone }}"
  73. record: "{{ hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace('.' + openshift_openstack_nsupdate_zone, '') }}"
  74. value: "{{ openshift_openstack_public_api_ip }}"
  75. type: "A"
  76. state: "{{ l_dns_record_state | default('present') }}"
  77. register: nsupdate_add_result
  78. until: nsupdate_add_result is succeeded
  79. retries: 10
  80. delay: 1
  81. when:
  82. - groups.masters
  83. - hostvars[groups.masters[0]].openshift_master_cluster_public_hostname is defined
  84. - openshift_openstack_public_api_ip is defined
  85. - openshift_openstack_public_api_ip is not none
  86. - openshift_openstack_public_api_ip | string