-
Notifications
You must be signed in to change notification settings - Fork 23
Ubuntu Focal to Jammy migration support #902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ba63ccb
Add playbook to upgrade ubuntu focal hosts
Alex-Welsh 3bcd1fb
add do-release-upgrade is installation task
seunghun1ee 84e0dab
Fix ubuntu upgrade playbook
Alex-Welsh 2d1359c
Fix networking outage during ubuntu upgrade
Alex-Welsh 60dffea
Add updating subset of ansible facts after do-release-upgrade
seunghun1ee 73a038a
Add shell script to automate ubuntu upgrade
seunghun1ee c6bef3a
Add release note
seunghun1ee cb4902b
fix trailing space
seunghun1ee e625c48
Fix typo and praying
seunghun1ee af51a26
Add kolla limit and override os_release to jammy as safety
seunghun1ee 08d299b
Update ubuntu upgrade scripts after review
Alex-Welsh d8a4a4f
Rename ubuntu upgrade scripts
Alex-Welsh 18df72b
Improved ubuntu upgrade script
Alex-Welsh 5203d01
Trim trailing whitespaces
seunghun1ee 75b7701
Run OVN chassis playbook after Jammy upgrade
Alex-Welsh 421740b
Improve ubuntu upgrade playbook reliability
Alex-Welsh 09da39c
Remove kolla limit for infra vm host configure
seunghun1ee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
--- | ||
# 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. | ||
- name: Migrate hosts from Ubuntu Focal 20.04 to Jammy 22.04 | ||
hosts: overcloud:infra-vms:seed:seed-hypervisor | ||
vars: | ||
ansible_python_interpreter: /usr/bin/python3 | ||
tasks: | ||
- name: Assert that hosts are running Ubuntu Focal | ||
assert: | ||
that: | ||
- ansible_facts.distribution == 'Ubuntu' | ||
- ansible_facts.distribution_major_version == '20' | ||
- ansible_facts.distribution_release == 'focal' | ||
- os_distribution == 'ubuntu' | ||
fail_msg: >- | ||
This playbook is only designed for Ubuntu Focal 20.04 hosts. Ensure | ||
that you are limiting it to only run on Focal hosts and | ||
os_distribution is set to ubuntu. | ||
|
||
- name: Ensure apt packages are up to date | ||
apt: | ||
update_cache: true | ||
upgrade: yes | ||
become: true | ||
|
||
- name: Ensure do-release-upgrade is installed | ||
package: | ||
name: ubuntu-release-upgrader-core | ||
Alex-Welsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
state: latest | ||
become: true | ||
|
||
- name: Check whether a reboot is required | ||
stat: | ||
path: /var/run/reboot-required | ||
register: file_status | ||
|
||
- name: Reboot to apply updates | ||
reboot: | ||
reboot_timeout: 1200 | ||
connect_timeout: 600 | ||
become: true | ||
when: file_status.stat.exists | ||
|
||
# NOTE: We cannot use apt_repository here because definitions must exist within the standard repos.list | ||
- name: Ensure Jammy repo definitions exist in sources.list | ||
blockinfile: | ||
path: /etc/apt/sources.list | ||
block: | | ||
deb {{ stackhpc_repo_ubuntu_jammy_url }} jammy main restricted universe multiverse | ||
deb {{ stackhpc_repo_ubuntu_jammy_url }} jammy-updates main restricted universe multiverse | ||
deb {{ stackhpc_repo_ubuntu_jammy_url }} jammy-backports main restricted universe multiverse | ||
deb {{ stackhpc_repo_ubuntu_jammy_security_url }} jammy-security main restricted universe multiverse | ||
markgoddard marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
become: true | ||
|
||
- name: Do release upgrade | ||
command: do-release-upgrade -f DistUpgradeViewNonInteractive | ||
become: true | ||
|
||
- name: Ensure old venvs do not exist | ||
file: | ||
path: "/opt/kayobe/venvs/{{ item }}" | ||
state: absent | ||
loop: | ||
- kayobe | ||
- kolla-ansible | ||
become: true | ||
|
||
- name: Update Python and current user facts before re-creating Kayobe venv | ||
ansible.builtin.setup: | ||
filter: "{{ kayobe_ansible_setup_filter }}" | ||
gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" | ||
|
||
- 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" | ||
|
||
- 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" | ||
|
||
- name: Reboot and confirm the host is upgraded to Jammy 22.04 | ||
hosts: overcloud:infra-vms:seed:seed-hypervisor | ||
vars: | ||
ansible_python_interpreter: /usr/bin/python3 | ||
markgoddard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tasks: | ||
- name: Ensure Jammy repo definitions do not exist in sources.list | ||
blockinfile: | ||
path: /etc/apt/sources.list | ||
state: absent | ||
become: true | ||
|
||
- name: Reboot and wait | ||
reboot: | ||
reboot_timeout: 1200 | ||
connect_timeout: 600 | ||
become: true | ||
|
||
- name: Update distribution facts | ||
ansible.builtin.setup: | ||
filter: "{{ kayobe_ansible_setup_filter }}" | ||
gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" | ||
|
||
- name: Assert that hosts are now using Ubuntu 22 | ||
assert: | ||
that: | ||
- ansible_facts.distribution_major_version == '22' | ||
- ansible_facts.distribution_release == 'jammy' | ||
technowhizz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Run the OVN chassis priority fix playbook | ||
import_playbook: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}/ansible/ovn-fix-chassis-priorities.yml" | ||
when: kolla_enable_ovn | ||
seunghun1ee marked this conversation as resolved.
Show resolved
Hide resolved
|
4 changes: 4 additions & 0 deletions
4
releasenotes/notes/add-automated-ubuntu-migration-support-2d7e8a6e1a2103cc.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
features: | ||
- | | ||
Add support for automated Ubuntu Focal to Jammy migration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#! /usr/bin/bash | ||
|
||
set -e | ||
|
||
if [[ ! $1 ]]; then | ||
echo "Usage: infra-vm-ubuntu-upgrade.sh <infra-vm-hostname>" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $KAYOBE_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_PATH is not defined" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $KAYOBE_CONFIG_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_CONFIG_PATH is not defined" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $ANSIBLE_ROLES_PATH ]]; then | ||
set -x | ||
export ANSIBLE_ROLES_PATH=$KAYOBE_PATH/ansible/roles | ||
set +x | ||
else | ||
set -x | ||
export ANSIBLE_ROLES_PATH=$ANSIBLE_ROLES_PATH:$KAYOBE_PATH/ansible/roles | ||
set +x | ||
fi | ||
|
||
set -x | ||
|
||
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/ubuntu-upgrade.yml -e os_release=jammy --limit $1 | ||
|
||
kayobe infra vm host configure --limit $1 -e os_release=jammy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#! /usr/bin/bash | ||
|
||
set -e | ||
|
||
if [[ ! $1 ]]; then | ||
echo "Usage: overcloud-ubuntu-upgrade.sh <overcloud-hostname>" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $KAYOBE_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_PATH is not defined" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $KAYOBE_CONFIG_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_CONFIG_PATH is not defined" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $ANSIBLE_ROLES_PATH ]]; then | ||
set -x | ||
export ANSIBLE_ROLES_PATH=$KAYOBE_PATH/ansible/roles | ||
set +x | ||
else | ||
set -x | ||
export ANSIBLE_ROLES_PATH=$ANSIBLE_ROLES_PATH:$KAYOBE_PATH/ansible/roles | ||
set +x | ||
fi | ||
|
||
set -x | ||
|
||
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/ubuntu-upgrade.yml -e os_release=jammy --limit $1 | ||
|
||
kayobe overcloud host configure --limit $1 --kolla-limit $1 -e os_release=jammy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! /usr/bin/bash | ||
|
||
set -e | ||
|
||
if [[ ! $KAYOBE_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_PATH is not defined" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $KAYOBE_CONFIG_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_CONFIG_PATH is not defined" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $ANSIBLE_ROLES_PATH ]]; then | ||
set -x | ||
export ANSIBLE_ROLES_PATH=$KAYOBE_PATH/ansible/roles | ||
set +x | ||
else | ||
set -x | ||
export ANSIBLE_ROLES_PATH=$ANSIBLE_ROLES_PATH:$KAYOBE_PATH/ansible/roles | ||
set +x | ||
fi | ||
|
||
set -x | ||
|
||
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/ubuntu-upgrade.yml -e os_release=jammy --limit seed-hypervisor | ||
|
||
kayobe seed hypervisor host configure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! /usr/bin/bash | ||
|
||
set -e | ||
|
||
if [[ ! $KAYOBE_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_PATH is not defined" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $KAYOBE_CONFIG_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_CONFIG_PATH is not defined" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! $ANSIBLE_ROLES_PATH ]]; then | ||
set -x | ||
export ANSIBLE_ROLES_PATH=$KAYOBE_PATH/ansible/roles | ||
set +x | ||
else | ||
set -x | ||
export ANSIBLE_ROLES_PATH=$ANSIBLE_ROLES_PATH:$KAYOBE_PATH/ansible/roles | ||
set +x | ||
fi | ||
|
||
set -x | ||
|
||
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/ubuntu-upgrade.yml -e os_release=jammy --limit seed | ||
|
||
kayobe seed host configure |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.