|
1 | 1 | ---
|
2 | 2 | # To prevent Ansible role dependency errors, this playbook requires that environment variable
|
3 | 3 | # ANSIBLE_ROLES_PATH is defined and includes '$KAYOBE_PATH/ansible/roles' on the Ansible control host.
|
4 |
| -- name: Migrate hosts from Ubuntu Jammy 22.04 to Noble 24.04 |
| 4 | +# Where KAYOBE_PATH is the path to the source of kayobe that the environment uses. |
| 5 | +- name: Prepare upgrade from Ubuntu Jammy 22.04 to Noble 24.04 |
5 | 6 | hosts: overcloud:infra-vms:seed:seed-hypervisor
|
6 | 7 | vars:
|
7 | 8 | ansible_python_interpreter: /usr/bin/python3
|
8 | 9 | reboot_timeout_s: "{{ 20 * 60 }}"
|
| 10 | + tags: pre |
9 | 11 | tasks:
|
10 | 12 | - name: Assert that hosts are running Ubuntu Jammy
|
11 | 13 | ansible.builtin.assert:
|
|
63 | 65 | deb {{ stackhpc_repo_ubuntu_noble_security_url }} noble-security main restricted universe multiverse
|
64 | 66 | become: true
|
65 | 67 |
|
66 |
| - - name: Do release upgrade |
67 |
| - ansible.builtin.command: do-release-upgrade -f DistUpgradeViewNonInteractive |
| 68 | + - name: Enusre /tmp is mounted with exec |
| 69 | + ansible.posix.mount: |
| 70 | + path: /tmp |
| 71 | + opts: exec |
| 72 | + state: remounted |
68 | 73 | become: true
|
69 | 74 |
|
| 75 | + - name: Ensure /var/lib/cephadm directory exists |
| 76 | + ansible.builtin.file: |
| 77 | + path: /var/lib/cephadm |
| 78 | + state: directory |
| 79 | + owner: root |
| 80 | + group: root |
| 81 | + become: true |
| 82 | + when: inventory_hostname in groups['ceph'] |
| 83 | + |
| 84 | +- name: Upgrade hosts from Ubuntu Jammy 22.04 to Noble 24.04 |
| 85 | + hosts: overcloud:infra-vms:seed:seed-hypervisor |
| 86 | + vars: |
| 87 | + ansible_python_interpreter: /usr/bin/python3 |
| 88 | + reboot_timeout_s: "{{ 20 * 60 }}" |
| 89 | + tags: upgrade |
| 90 | + tasks: |
| 91 | + - name: Perform in-place Ubuntu upgrade |
| 92 | + block: |
| 93 | + - name: Run do-release-upgrade |
| 94 | + ansible.builtin.command: do-release-upgrade -f DistUpgradeViewNonInteractive |
| 95 | + become: true |
| 96 | + rescue: |
| 97 | + - name: Ensure Noble repo definitions do not exist in sources.list |
| 98 | + ansible.builtin.blockinfile: |
| 99 | + path: /etc/apt/sources.list |
| 100 | + state: absent |
| 101 | + become: true |
| 102 | + |
| 103 | + - name: Ensure Kolla Ansible Docker repo definition does not exist |
| 104 | + ansible.builtin.file: |
| 105 | + path: /etc/apt/sources.list.d/docker.list |
| 106 | + state: absent |
| 107 | + become: true |
| 108 | + when: apt_repositories | selectattr('url', 'match', '.*docker-ce.*') | list | length > 0 |
| 109 | + |
| 110 | + - name: Display recommanded action on upgrade failure |
| 111 | + ansible.builtin.debug: |
| 112 | + msg: > |
| 113 | + Ubuntu upgrade failed. You can check the upgrade logs at /var/log/dist-upgrade |
| 114 | + on the failed host. |
| 115 | + It is likely due to packages with broken dependency. You can find broken packages |
| 116 | + by running following command from the host. |
| 117 | + cat /var/log/dist-upgrade/apt.log | grep "Holding Back" | awk '{print $3}' |
| 118 | +
|
| 119 | + - name: Fail fast when upgrade fails |
| 120 | + ansible.builtin.meta: end_host |
| 121 | + |
| 122 | +- name: Post upgrade of Ubuntu Jammy 22.04 to Noble 24.04 |
| 123 | + hosts: overcloud:infra-vms:seed:seed-hypervisor |
| 124 | + vars: |
| 125 | + ansible_python_interpreter: /usr/bin/python3 |
| 126 | + reboot_timeout_s: "{{ 20 * 60 }}" |
| 127 | + tags: post |
| 128 | + tasks: |
70 | 129 | - name: Ensure old venvs do not exist
|
71 | 130 | ansible.builtin.file:
|
72 | 131 | path: /opt/kayobe/venvs/{{ item }}
|
|
83 | 142 |
|
84 | 143 | - name: Run the Kayobe kayobe-target-venv playbook to ensure kayobe venv exists on remote host
|
85 | 144 | import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/kayobe-target-venv.yml"
|
| 145 | + tags: post |
| 146 | + |
| 147 | +- name: Run the Kayobe apt playbook to ensure Noble repositories are set on remote host |
| 148 | + import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/apt.yml" |
| 149 | + tags: post |
| 150 | + |
| 151 | +- name: Fix broken packages after upgrade |
| 152 | + hosts: overcloud:infra-vms:seed:seed-hypervisor |
| 153 | + tags: post |
| 154 | + tasks: |
| 155 | + - name: Ensure iproute2 is installed |
| 156 | + ansible.builtin.apt: |
| 157 | + name: iproute2 |
| 158 | + state: present |
| 159 | + become: true |
| 160 | + - name: Ensure cephadm dependencies are installed |
| 161 | + ansible.builtin.apt: |
| 162 | + name: |
| 163 | + - python3-yaml |
| 164 | + - python3-jinja2 |
| 165 | + state: present |
| 166 | + become: true |
| 167 | + when: inventory_hostname in groups['ceph'] |
| 168 | + |
| 169 | + - name: Update Python and current user facts before running Kayobe network playbook |
| 170 | + ansible.builtin.setup: |
| 171 | + filter: "{{ kayobe_ansible_setup_filter }}" |
| 172 | + gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" |
86 | 173 |
|
87 | 174 | - name: Run the Kayobe network configuration playbook, to ensure definitions are not lost on reboot
|
88 | 175 | import_playbook: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/share/kayobe/ansible/network.yml"
|
| 176 | + tags: post |
89 | 177 |
|
90 | 178 | - name: Reboot and confirm the host is upgraded to Noble 24.04
|
91 | 179 | hosts: overcloud:infra-vms:seed:seed-hypervisor
|
92 | 180 | vars:
|
93 | 181 | ansible_python_interpreter: /usr/bin/python3
|
94 | 182 | reboot_timeout_s: "{{ 20 * 60 }}"
|
| 183 | + tags: post |
95 | 184 | tasks:
|
96 | 185 | - name: Ensure Noble repo definitions do not exist in sources.list
|
97 | 186 | ansible.builtin.blockinfile:
|
|
121 | 210 | - /usr/local/sbin
|
122 | 211 | become: true
|
123 | 212 |
|
| 213 | + - name: Ensure only Kayobe defined apt repositories are defined |
| 214 | + ansible.builtin.file: |
| 215 | + path: "/etc/apt/{{ item }}" |
| 216 | + state: absent |
| 217 | + loop: |
| 218 | + - sources.list.distUpgrade |
| 219 | + - sources.list.d/third-party.sources |
| 220 | + - sources.list.d/ubuntu.sources |
| 221 | + become: true |
| 222 | + when: hostvars[inventory_hostname].stackhpc_repos_enabled |
| 223 | + |
| 224 | + - name: Ensure all packages are in Noble version |
| 225 | + ansible.builtin.apt: |
| 226 | + upgrade: full |
| 227 | + update_cache: true |
| 228 | + become: true |
| 229 | + |
124 | 230 | - name: Update distribution facts
|
125 | 231 | ansible.builtin.setup:
|
126 | 232 | filter: "{{ kayobe_ansible_setup_filter }}"
|
|
0 commit comments