From be90221169cbb432b99dccf517fb1c07d2807624 Mon Sep 17 00:00:00 2001
From: Richard J Osborne <20555769+rjo-uk@users.noreply.github.com>
Date: Fri, 4 Oct 2024 17:38:52 +0100
Subject: [PATCH 1/3] Add option to skip the update/reboot on pre-upgraded
server
---
.../fragments/option_to_skip_pre_upgrade_update_boot.yml | 2 ++
roles/upgrade/README.md | 1 +
roles/upgrade/defaults/main.yml | 3 +++
roles/upgrade/tasks/leapp-upgrade.yml | 1 +
4 files changed, 7 insertions(+)
create mode 100644 changelogs/fragments/option_to_skip_pre_upgrade_update_boot.yml
diff --git a/changelogs/fragments/option_to_skip_pre_upgrade_update_boot.yml b/changelogs/fragments/option_to_skip_pre_upgrade_update_boot.yml
new file mode 100644
index 0000000..9a662ce
--- /dev/null
+++ b/changelogs/fragments/option_to_skip_pre_upgrade_update_boot.yml
@@ -0,0 +1,2 @@
+minor_changes:
+- Add option to skip the initial update and reboot of the pre-upgraded server
diff --git a/roles/upgrade/README.md b/roles/upgrade/README.md
index 23c01e6..e1233a6 100644
--- a/roles/upgrade/README.md
+++ b/roles/upgrade/README.md
@@ -30,6 +30,7 @@ Additionally a list of any non-Red Hat RPM packages that were installed on the s
| kernel_modules_to_unload_before_upgrade | [] | A list of kernel modules to be unloaded prior to running leapp. |
| post_7_to_8_python_interpreter | /usr/libexec/platform-python | For RHEL 7 to 8 upgrades, /usr/bin/python is discovered but not available post upgrade. For 7 to 8 upgrades, ansible_python_interpreter is set to this value post upgrade reboot prior to reconnecting. |
| infra_leapp_upgrade_system_roles_collection | fedora.linux_system_roles | Can be one of:
- 'fedora.linux_system_roles'
- 'redhat.rhel_system_roles' |
+| skip_pre_upgrade_update_reboot | false | Skip the initial update and reboot on the running pre-upgrade operating system |
## Satellite variables
diff --git a/roles/upgrade/defaults/main.yml b/roles/upgrade/defaults/main.yml
index 1004197..4b94c52 100644
--- a/roles/upgrade/defaults/main.yml
+++ b/roles/upgrade/defaults/main.yml
@@ -113,6 +113,9 @@ crypto_policy: DEFAULT
# crypto_policy: FUTURE
# crypto_policy: DEFAULT:SHA1
+# Whether or not to skip the pre upgrade update and reboot of the operating system
+skip_pre_upgrade_update_reboot: false
+
# Whether or not to update from legacy grub to grub2 in post-upgrade steps from RHEL 6 -> 7.
update_grub_to_grub_2: false
post_upgrade_update: true
diff --git a/roles/upgrade/tasks/leapp-upgrade.yml b/roles/upgrade/tasks/leapp-upgrade.yml
index 212c1bf..51967eb 100644
--- a/roles/upgrade/tasks/leapp-upgrade.yml
+++ b/roles/upgrade/tasks/leapp-upgrade.yml
@@ -29,6 +29,7 @@
- name: leapp-upgrade | Include update-and-reboot.yml
ansible.builtin.include_tasks: update-and-reboot.yml
+ when: skip_pre_upgrade_update_reboot is not defined or not skip_pre_upgrade_update_reboot|bool
- name: leapp-upgrade | Create /etc/leapp/files/leapp_upgrade_repositories.repo
ansible.builtin.yum_repository:
From d563b97a9e88da4d3e2b020d7b95655ef8ac0081 Mon Sep 17 00:00:00 2001
From: Richard J Osborne <20555769+rjo-uk@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:52:45 +0100
Subject: [PATCH 2/3] Update variable name to control update/reboot on
pre-upgraded server
---
roles/upgrade/README.md | 1 +
roles/upgrade/defaults/main.yml | 4 +---
roles/upgrade/tasks/leapp-upgrade.yml | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/roles/upgrade/README.md b/roles/upgrade/README.md
index e1233a6..f61c55b 100644
--- a/roles/upgrade/README.md
+++ b/roles/upgrade/README.md
@@ -24,6 +24,7 @@ Additionally a list of any non-Red Hat RPM packages that were installed on the s
| async_timeout_maximum | 7200 | Variable used to set the asynchronous task timeout value (in seconds)
| async_poll_interval | 60 | Variable used to set the asynchronous task polling internal value (in seconds)
| check_leapp_analysis_results| true | Allows for running remediation and going straight to upgrade without re-running analysis. |
+| pre_upgrade_update | true | Boolean to decide if an update and reboot on the running pre-upgrade operating system will run. |
| post_upgrade_update | true | Boolean to decide if after the upgrade is performed a dnf update will run|
| post_upgrade_unset_release| true | Boolean used to control whether Leapp's RHSM release lock is unset.
| post_upgrade_release | | Optional string used to set a specific RHSM release lock after the Leapp upgrade, but before the final update pass.
diff --git a/roles/upgrade/defaults/main.yml b/roles/upgrade/defaults/main.yml
index 4b94c52..16dfe4a 100644
--- a/roles/upgrade/defaults/main.yml
+++ b/roles/upgrade/defaults/main.yml
@@ -113,11 +113,9 @@ crypto_policy: DEFAULT
# crypto_policy: FUTURE
# crypto_policy: DEFAULT:SHA1
-# Whether or not to skip the pre upgrade update and reboot of the operating system
-skip_pre_upgrade_update_reboot: false
-
# Whether or not to update from legacy grub to grub2 in post-upgrade steps from RHEL 6 -> 7.
update_grub_to_grub_2: false
+pre_upgrade_update: true
post_upgrade_update: true
post_upgrade_unset_release: true
post_upgrade_release: ""
diff --git a/roles/upgrade/tasks/leapp-upgrade.yml b/roles/upgrade/tasks/leapp-upgrade.yml
index 51967eb..74d1aa0 100644
--- a/roles/upgrade/tasks/leapp-upgrade.yml
+++ b/roles/upgrade/tasks/leapp-upgrade.yml
@@ -29,7 +29,7 @@
- name: leapp-upgrade | Include update-and-reboot.yml
ansible.builtin.include_tasks: update-and-reboot.yml
- when: skip_pre_upgrade_update_reboot is not defined or not skip_pre_upgrade_update_reboot|bool
+ when: pre_upgrade_update | bool
- name: leapp-upgrade | Create /etc/leapp/files/leapp_upgrade_repositories.repo
ansible.builtin.yum_repository:
From dbd66e14179c1c2e1cffe68e279147e3a67c0274 Mon Sep 17 00:00:00 2001
From: Richard J Osborne <20555769+rjo-uk@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:54:42 +0100
Subject: [PATCH 3/3] Remove obsolete documentation for
skip_pre_upgrade_update_reboot
---
roles/upgrade/README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/roles/upgrade/README.md b/roles/upgrade/README.md
index f61c55b..793c221 100644
--- a/roles/upgrade/README.md
+++ b/roles/upgrade/README.md
@@ -31,7 +31,6 @@ Additionally a list of any non-Red Hat RPM packages that were installed on the s
| kernel_modules_to_unload_before_upgrade | [] | A list of kernel modules to be unloaded prior to running leapp. |
| post_7_to_8_python_interpreter | /usr/libexec/platform-python | For RHEL 7 to 8 upgrades, /usr/bin/python is discovered but not available post upgrade. For 7 to 8 upgrades, ansible_python_interpreter is set to this value post upgrade reboot prior to reconnecting. |
| infra_leapp_upgrade_system_roles_collection | fedora.linux_system_roles | Can be one of:
- 'fedora.linux_system_roles'
- 'redhat.rhel_system_roles' |
-| skip_pre_upgrade_update_reboot | false | Skip the initial update and reboot on the running pre-upgrade operating system |
## Satellite variables