10-quay-tmp-fixes.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. ---
  2. # These are the temporary tasks needed on workstation before classroom build is finished.
  3. - name: Fixes required on utility VM.
  4. hosts: utility.lab.example.com
  5. become: yes
  6. gather_subset: min
  7. tasks:
  8. # XXX DONE XXX # Fixing the DNS first.
  9. # XXX DONE XXX - name: add ocp4.example.com hosts to /etc/hosts
  10. # XXX DONE XXX become: yes
  11. # XXX DONE XXX ansible.builtin.lineinfile:
  12. # XXX DONE XXX path: /etc/hosts
  13. # XXX DONE XXX mode: 0644
  14. # XXX DONE XXX regex: "{{ item.hostname }}"
  15. # XXX DONE XXX line: "{{ item.addr }} {{ item.hostname }}"
  16. # XXX DONE XXX state: present
  17. # XXX DONE XXX loop:
  18. # XXX DONE XXX - addr: 192.168.50.40
  19. # XXX DONE XXX hostname: idm.ocp4.example.com
  20. # XXX DONE XXX - addr: 192.168.50.50
  21. # XXX DONE XXX hostname: registry.ocp4.example.com
  22. # XXX DONE XXX - addr: 192.168.50.10
  23. # XXX DONE XXX hostname: master01.ocp4.example.com
  24. # XXX DONE XXX - addr: 192.168.50.11
  25. # XXX DONE XXX hostname: master02.ocp4.example.com
  26. # XXX DONE XXX - addr: 192.168.50.12
  27. # XXX DONE XXX hostname: master03.ocp4.example.com
  28. # XXX DONE XXX - addr: 192.168.50.13
  29. # XXX DONE XXX hostname: worker01.ocp4.example.com
  30. # XXX DONE XXX - addr: 192.168.50.14
  31. # XXX DONE XXX hostname: worker02.ocp4.example.com
  32. # XXX DONE XXX
  33. # XXX DONE XXX - name: Ensure dnsmasq is installed.
  34. # XXX DONE XXX ansible.builtin.yum:
  35. # XXX DONE XXX name:
  36. # XXX DONE XXX - dnsmasq
  37. # XXX DONE XXX - dnsmasq-utils
  38. # XXX DONE XXX state: present
  39. # XXX DONE XXX
  40. # XXX DONE XXX - name: Ensure dnsmasq is listening on all interfaces
  41. # XXX DONE XXX ansible.builtin.lineinfile:
  42. # XXX DONE XXX path: /etc/dnsmasq.conf
  43. # XXX DONE XXX mode: 0644
  44. # XXX DONE XXX regex: "^interface=(.*)$"
  45. # XXX DONE XXX line: '#interface=\g<1>'
  46. # XXX DONE XXX backrefs: yes
  47. # XXX DONE XXX
  48. # XXX DONE XXX - name: Ensure dnsmasq is enabled and running.
  49. # XXX DONE XXX ansible.builtin.systemd_service:
  50. # XXX DONE XXX name: dnsmasq
  51. # XXX DONE XXX enabled: yes
  52. # XXX DONE XXX state: started
  53. # XXX DONE XXX
  54. # XXX DONE XXX - name: Ensure DNS is open in the firewall.
  55. # XXX DONE XXX ansible.posix.firewalld:
  56. # XXX DONE XXX immediate: yes
  57. # XXX DONE XXX permanent: yes
  58. # XXX DONE XXX zone: "{{ item }}"
  59. # XXX DONE XXX service: dns
  60. # XXX DONE XXX state: enabled
  61. # XXX DONE XXX loop:
  62. # XXX DONE XXX - external
  63. # XXX DONE XXX - public
  64. - name: Ensure idm is in ocp4.example.com zone.
  65. ansible.builtin.lineinfile:
  66. path: /var/named/ocp4.example.com.db
  67. regex: '^idm[[:space:]]'
  68. insertafter: '.*IN NS dns\.ocp4\.example\.com\.$'
  69. line: 'idm IN A 192.168.50.40'
  70. notify:
  71. - fix forward zone serial
  72. - restart named
  73. - name: Ensure idm is in ocp4.example.com reverse zone.
  74. ansible.builtin.lineinfile:
  75. path: /var/named/ocp4.example.com.reverse.db
  76. regex: '^40[[:space:]]'
  77. insertafter: '.*IN NS dns\.ocp4\.example\.com\.$'
  78. line: '40 IN PTR idm.ocp4.example.com.'
  79. notify:
  80. - fix reverse zone serial
  81. - restart named
  82. - name: Ensure utility allows forwarding traffic from external to public/trusted zones.
  83. ansible.builtin.copy:
  84. dest: /etc/firewalld/policies/fwd-stud-to-ocp.xml
  85. mode: 0644
  86. owner: root
  87. group: root
  88. content: |
  89. <?xml version="1.0" encoding="utf-8"?>
  90. <policy target="ACCEPT">
  91. <ingress-zone name="external"/>
  92. <egress-zone name="public"/>
  93. <egress-zone name="trusted"/>
  94. </policy>
  95. notify:
  96. - reload utility firewalld
  97. handlers:
  98. - name: reload utility firewalld
  99. ansible.builtin.service:
  100. name: firewalld
  101. state: reloaded
  102. - name: fix forward zone serial
  103. ansible.builtin.lineinfile:
  104. path: /var/named/ocp4.example.com.db
  105. regex: '.*; serial$'
  106. line: " {{ ansible_facts['date_time']['year'] }}{{ ansible_facts['date_time']['month'] }}{{ ansible_facts['date_time']['day'] }}00"
  107. - name: fix reverse zone serial
  108. ansible.builtin.lineinfile:
  109. path: /var/named/ocp4.example.com.reverse.db
  110. regex: '.*; serial$'
  111. line: " {{ ansible_facts['date_time']['year'] }}{{ ansible_facts['date_time']['month'] }}{{ ansible_facts['date_time']['day'] }}00"
  112. - name: restart named
  113. ansible.builtin.service:
  114. name: named
  115. state: restarted
  116. - name: Fix registry VM configuration.
  117. hosts: registry.ocp4.example.com
  118. become: yes
  119. gather_facts: no
  120. tasks:
  121. - name: Ensure eth1 interface is in public zone.
  122. ansible.builtin.firewalld:
  123. zone: public
  124. interface: eth1
  125. immediate: yes
  126. permanent: yes
  127. state: enabled
  128. notify:
  129. - reload registry firewalld
  130. # XXX DONE XXX #- name: Ensure registry is using bastion as the DNS
  131. # XXX DONE XXX # community.general.nmcli:
  132. # XXX DONE XXX # conn_name: "System eth1"
  133. # XXX DONE XXX # dns4: 172.25.250.254
  134. # XXX DONE XXX # state: present
  135. # XXX DONE XXX # notify:
  136. # XXX DONE XXX # - bounce eth1
  137. handlers:
  138. - name: reload registry firewalld
  139. ansible.builtin.service:
  140. name: firewalld
  141. state: reloaded
  142. # XXX DONE XXX #- name: reload connections
  143. # XXX DONE XXX # listen: bounce eth1
  144. # XXX DONE XXX # ansible.builtin.command: nmcli con reload
  145. # XXX DONE XXX
  146. # XXX DONE XXX #- name: take eth1 down
  147. # XXX DONE XXX # listen: bounce eth1
  148. # XXX DONE XXX # ansible.builtin.command: nmcli con down "System eth1"
  149. # XXX DONE XXX
  150. # XXX DONE XXX #- name: bring eth1 up
  151. # XXX DONE XXX # listen: bounce eth1
  152. # XXX DONE XXX # ansible.builtin.command: nmcli con up "System eth1"
  153. ...