|
139 | 139 | ansible.builtin.setup: |
140 | 140 | filter: "{{ kayobe_ansible_setup_filter }}" |
141 | 141 | gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" |
| 142 | + vars: |
| 143 | + ansible_python_interpreter: /usr/bin/python3 |
| 144 | + |
| 145 | +- name: Run the Kayobe network configuration playbook, to ensure definitions are not lost on reboot |
| 146 | + import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/network.yml" |
| 147 | + vars: |
| 148 | + ansible_python_interpreter: /usr/bin/python3 |
| 149 | + tags: post |
142 | 150 |
|
143 | 151 | - name: Run the Kayobe kayobe-target-venv playbook to ensure kayobe venv exists on remote host |
144 | 152 | import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/kayobe-target-venv.yml" |
145 | 153 | tags: post |
146 | 154 |
|
| 155 | +- name: Clean up old repos |
| 156 | + hosts: overcloud:infra-vms:seed:seed-hypervisor |
| 157 | + vars: |
| 158 | + ansible_python_interpreter: /usr/bin/python3 |
| 159 | + tags: |
| 160 | + - post |
| 161 | + - cleanup-repos |
| 162 | + tasks: |
| 163 | + - name: Ensure Noble repo definitions do not exist in sources.list |
| 164 | + ansible.builtin.blockinfile: |
| 165 | + path: "{{ item }}" |
| 166 | + state: absent |
| 167 | + become: true |
| 168 | + loop: |
| 169 | + - /etc/apt/sources.list |
| 170 | + |
| 171 | + - name: Ensure Kolla Ansible Docker repo definition does not exist |
| 172 | + ansible.builtin.file: |
| 173 | + path: /etc/apt/sources.list.d/docker.list |
| 174 | + state: absent |
| 175 | + become: true |
| 176 | + when: apt_repositories | selectattr('url', 'match', '.*docker-ce.*') | list | length > 0 |
| 177 | + |
| 178 | + # Make a backup, in case of having broken apt configuration. |
| 179 | + - name: Backup upstream ubuntu.sources |
| 180 | + ansible.builtin.copy: |
| 181 | + src: /etc/apt/sources.list.d/ubuntu.sources |
| 182 | + dest: /etc/apt/ubuntu.sources.bak |
| 183 | + backup: true |
| 184 | + remote_src: true |
| 185 | + become: true |
| 186 | + when: hostvars[inventory_hostname].stackhpc_repos_enabled |
| 187 | + tags: post |
| 188 | + |
| 189 | + - name: Ensure only Kayobe defined apt repositories are defined |
| 190 | + ansible.builtin.file: |
| 191 | + path: "/etc/apt/{{ item }}" |
| 192 | + state: absent |
| 193 | + loop: |
| 194 | + - sources.list.distUpgrade |
| 195 | + - sources.list.d/third-party.sources |
| 196 | + - sources.list.d/ubuntu.sources |
| 197 | + become: true |
| 198 | + when: hostvars[inventory_hostname].stackhpc_repos_enabled |
| 199 | + tags: post |
| 200 | + |
147 | 201 | - name: Run the Kayobe apt playbook to ensure Noble repositories are set on remote host |
148 | 202 | import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/apt.yml" |
149 | | - tags: post |
| 203 | + tags: |
| 204 | + - post |
| 205 | + - post-cleanup |
150 | 206 |
|
151 | 207 | - name: Fix broken packages after upgrade |
152 | 208 | hosts: overcloud:infra-vms:seed:seed-hypervisor |
153 | | - tags: post |
| 209 | + tags: |
| 210 | + - post |
| 211 | + - post-cleanup |
154 | 212 | tasks: |
155 | 213 | - name: Ensure iproute2 is installed |
156 | 214 | ansible.builtin.apt: |
|
171 | 229 | filter: "{{ kayobe_ansible_setup_filter }}" |
172 | 230 | gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" |
173 | 231 |
|
174 | | -- name: Run the Kayobe network configuration playbook, to ensure definitions are not lost on reboot |
175 | | - import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/network.yml" |
176 | | - tags: post |
177 | | - |
178 | 232 | - name: Reboot and confirm the host is upgraded to Noble 24.04 |
179 | 233 | hosts: overcloud:infra-vms:seed:seed-hypervisor |
180 | 234 | vars: |
181 | 235 | ansible_python_interpreter: /usr/bin/python3 |
182 | 236 | reboot_timeout_s: "{{ 20 * 60 }}" |
183 | | - tags: post |
| 237 | + tags: |
| 238 | + - post |
| 239 | + - post-cleanup |
184 | 240 | tasks: |
185 | | - - name: Ensure Noble repo definitions do not exist in sources.list |
186 | | - ansible.builtin.blockinfile: |
187 | | - path: /etc/apt/sources.list |
188 | | - state: absent |
189 | | - become: true |
190 | | - |
191 | | - - name: Ensure Kolla Ansible Docker repo definition does not exist |
192 | | - ansible.builtin.file: |
193 | | - path: /etc/apt/sources.list.d/docker.list |
194 | | - state: absent |
195 | | - become: true |
196 | | - when: apt_repositories | selectattr('url', 'match', '.*docker-ce.*') | list | length > 0 |
197 | | - |
198 | 241 | - name: Reboot and wait |
199 | 242 | ansible.builtin.reboot: |
200 | 243 | reboot_timeout: "{{ reboot_timeout_s }}" |
|
210 | 253 | - /usr/local/sbin |
211 | 254 | become: true |
212 | 255 |
|
213 | | - # Make a backup, in case of having broken apt configuration. |
214 | | - - name: Backup upstream ubuntu.sources |
215 | | - ansible.builtin.copy: |
216 | | - src: /etc/apt/sources.list.d/ubuntu.sources |
217 | | - dest: /etc/apt/ubuntu.sources.bak |
218 | | - backup: true |
219 | | - remote_src: true |
220 | | - become: true |
221 | | - when: hostvars[inventory_hostname].stackhpc_repos_enabled |
222 | | - |
223 | | - - name: Ensure only Kayobe defined apt repositories are defined |
224 | | - ansible.builtin.file: |
225 | | - path: "/etc/apt/{{ item }}" |
226 | | - state: absent |
227 | | - loop: |
228 | | - - sources.list.distUpgrade |
229 | | - - sources.list.d/third-party.sources |
230 | | - - sources.list.d/ubuntu.sources |
231 | | - become: true |
232 | | - when: hostvars[inventory_hostname].stackhpc_repos_enabled |
233 | | - |
234 | 256 | - name: Ensure all packages are in Noble version |
235 | 257 | ansible.builtin.apt: |
236 | 258 | upgrade: full |
|
0 commit comments