|
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: /etc/apt/sources.list |
| 166 | + state: absent |
| 167 | + become: true |
| 168 | + |
| 169 | + - name: Ensure Kolla Ansible Docker repo definition does not exist |
| 170 | + ansible.builtin.file: |
| 171 | + path: /etc/apt/sources.list.d/docker.list |
| 172 | + state: absent |
| 173 | + become: true |
| 174 | + when: apt_repositories | selectattr('url', 'match', '.*docker-ce.*') | list | length > 0 |
| 175 | + |
| 176 | + # Make a backup, in case of having broken apt configuration. |
| 177 | + - name: Backup upstream ubuntu.sources |
| 178 | + ansible.builtin.copy: |
| 179 | + src: /etc/apt/sources.list.d/ubuntu.sources |
| 180 | + dest: /etc/apt/ubuntu.sources.bak |
| 181 | + backup: true |
| 182 | + remote_src: true |
| 183 | + become: true |
| 184 | + when: hostvars[inventory_hostname].stackhpc_repos_enabled |
| 185 | + |
| 186 | + - name: Ensure only Kayobe defined apt repositories are defined |
| 187 | + ansible.builtin.file: |
| 188 | + path: "/etc/apt/{{ item }}" |
| 189 | + state: absent |
| 190 | + loop: |
| 191 | + - sources.list.distUpgrade |
| 192 | + - sources.list.d/third-party.sources |
| 193 | + - sources.list.d/ubuntu.sources |
| 194 | + become: true |
| 195 | + when: hostvars[inventory_hostname].stackhpc_repos_enabled |
| 196 | + |
147 | 197 | - name: Run the Kayobe apt playbook to ensure Noble repositories are set on remote host |
148 | 198 | import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/apt.yml" |
149 | | - tags: post |
| 199 | + tags: |
| 200 | + - post |
| 201 | + - post-cleanup |
150 | 202 |
|
151 | 203 | - name: Fix broken packages after upgrade |
152 | 204 | hosts: overcloud:infra-vms:seed:seed-hypervisor |
153 | | - tags: post |
| 205 | + tags: |
| 206 | + - post |
| 207 | + - post-cleanup |
154 | 208 | tasks: |
155 | 209 | - name: Ensure iproute2 is installed |
156 | 210 | ansible.builtin.apt: |
|
171 | 225 | filter: "{{ kayobe_ansible_setup_filter }}" |
172 | 226 | gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" |
173 | 227 |
|
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 | 228 | - name: Reboot and confirm the host is upgraded to Noble 24.04 |
179 | 229 | hosts: overcloud:infra-vms:seed:seed-hypervisor |
180 | 230 | vars: |
181 | 231 | ansible_python_interpreter: /usr/bin/python3 |
182 | 232 | reboot_timeout_s: "{{ 20 * 60 }}" |
183 | | - tags: post |
| 233 | + tags: |
| 234 | + - post |
| 235 | + - post-cleanup |
184 | 236 | 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 | 237 | - name: Reboot and wait |
199 | 238 | ansible.builtin.reboot: |
200 | 239 | reboot_timeout: "{{ reboot_timeout_s }}" |
|
210 | 249 | - /usr/local/sbin |
211 | 250 | become: true |
212 | 251 |
|
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 | 252 | - name: Ensure all packages are in Noble version |
235 | 253 | ansible.builtin.apt: |
236 | 254 | upgrade: full |
|
0 commit comments