Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 59 additions & 41 deletions etc/kayobe/ansible/ubuntu-upgrade.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in etc/kayobe/ansible/ubuntu-upgrade.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.15 lint with Python 3.10

syntax-check[missing-file]

Unable to retrieve file contents

Check warning on line 1 in etc/kayobe/ansible/ubuntu-upgrade.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.16 lint with Python 3.12

syntax-check[missing-file]

Unable to retrieve file contents
# To prevent Ansible role dependency errors, this playbook requires that environment variable
# ANSIBLE_ROLES_PATH is defined and includes '$KAYOBE_PATH/ansible/roles' on the Ansible control host.
# Where KAYOBE_PATH is the path to the source of kayobe that the environment uses.
Expand Down Expand Up @@ -139,18 +139,72 @@
ansible.builtin.setup:
filter: "{{ kayobe_ansible_setup_filter }}"
gather_subset: "{{ kayobe_ansible_setup_gather_subset }}"
vars:
ansible_python_interpreter: /usr/bin/python3

- name: Run the Kayobe network configuration playbook, to ensure definitions are not lost on reboot
import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/network.yml"
vars:
ansible_python_interpreter: /usr/bin/python3
tags: post

- name: Run the Kayobe kayobe-target-venv playbook to ensure kayobe venv exists on remote host
import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/kayobe-target-venv.yml"
tags: post

- name: Clean up old repos
hosts: overcloud:infra-vms:seed:seed-hypervisor
vars:
ansible_python_interpreter: /usr/bin/python3
tags:
- post
- cleanup-repos
tasks:
- name: Ensure Noble repo definitions do not exist in sources.list
ansible.builtin.blockinfile:
path: /etc/apt/sources.list
state: absent
become: true

- name: Ensure Kolla Ansible Docker repo definition does not exist
ansible.builtin.file:
path: /etc/apt/sources.list.d/docker.list
state: absent
become: true
when: apt_repositories | selectattr('url', 'match', '.*docker-ce.*') | list | length > 0

# Make a backup, in case of having broken apt configuration.
- name: Backup upstream ubuntu.sources
ansible.builtin.copy:
src: /etc/apt/sources.list.d/ubuntu.sources
dest: /etc/apt/ubuntu.sources.bak
backup: true
remote_src: true
become: true
when: hostvars[inventory_hostname].stackhpc_repos_enabled

- name: Ensure only Kayobe defined apt repositories are defined
ansible.builtin.file:
path: "/etc/apt/{{ item }}"
state: absent
loop:
- sources.list.distUpgrade
- sources.list.d/third-party.sources
- sources.list.d/ubuntu.sources
become: true
when: hostvars[inventory_hostname].stackhpc_repos_enabled

- name: Run the Kayobe apt playbook to ensure Noble repositories are set on remote host
import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/apt.yml"
tags: post
tags:
- post
- post-cleanup

- name: Fix broken packages after upgrade
hosts: overcloud:infra-vms:seed:seed-hypervisor
tags: post
tags:
- post
- post-cleanup
tasks:
- name: Ensure iproute2 is installed
ansible.builtin.apt:
Expand All @@ -171,30 +225,15 @@
filter: "{{ kayobe_ansible_setup_filter }}"
gather_subset: "{{ kayobe_ansible_setup_gather_subset }}"

- name: Run the Kayobe network configuration playbook, to ensure definitions are not lost on reboot
import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/network.yml"
tags: post

- name: Reboot and confirm the host is upgraded to Noble 24.04
hosts: overcloud:infra-vms:seed:seed-hypervisor
vars:
ansible_python_interpreter: /usr/bin/python3
reboot_timeout_s: "{{ 20 * 60 }}"
tags: post
tags:
- post
- post-cleanup
tasks:
- name: Ensure Noble repo definitions do not exist in sources.list
ansible.builtin.blockinfile:
path: /etc/apt/sources.list
state: absent
become: true

- name: Ensure Kolla Ansible Docker repo definition does not exist
ansible.builtin.file:
path: /etc/apt/sources.list.d/docker.list
state: absent
become: true
when: apt_repositories | selectattr('url', 'match', '.*docker-ce.*') | list | length > 0

- name: Reboot and wait
ansible.builtin.reboot:
reboot_timeout: "{{ reboot_timeout_s }}"
Expand All @@ -210,27 +249,6 @@
- /usr/local/sbin
become: true

# Make a backup, in case of having broken apt configuration.
- name: Backup upstream ubuntu.sources
ansible.builtin.copy:
src: /etc/apt/sources.list.d/ubuntu.sources
dest: /etc/apt/ubuntu.sources.bak
backup: true
remote_src: true
become: true
when: hostvars[inventory_hostname].stackhpc_repos_enabled

- name: Ensure only Kayobe defined apt repositories are defined
ansible.builtin.file:
path: "/etc/apt/{{ item }}"
state: absent
loop:
- sources.list.distUpgrade
- sources.list.d/third-party.sources
- sources.list.d/ubuntu.sources
become: true
when: hostvars[inventory_hostname].stackhpc_repos_enabled

- name: Ensure all packages are in Noble version
ansible.builtin.apt:
upgrade: full
Expand Down
Loading