10-quay-tmp-fixes.yml 6.1 KB

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