changeset 383:f9a6f6ff8256

Attempt to migrate CentOS8 to Streams automatically
author IBBoard <dev@ibboard.co.uk>
date Thu, 16 Dec 2021 20:37:58 +0000
parents 308b4149bee5
children 22e45bb5ea97
files manifests/templates.pp
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/manifests/templates.pp	Sun Nov 21 17:09:18 2021 +0000
+++ b/manifests/templates.pp	Thu Dec 16 20:37:58 2021 +0000
@@ -255,6 +255,19 @@
 
 	if $operatingsystem == 'CentOS' and versioncmp($operatingsystemrelease, '8') >= 0 {
 		$python_ver = 'python3'
+
+		# The following may possibly work to ensure a CentOS Streams install.
+		# Or it might fail for inexplicable reasons.
+		# FIXME: Should be "centos-release-stream" to migrate (provides repos), but then that gets replaced by centos-stream-release,
+		# which Puppet doesn't recognise as the same and so keeps trying to re-install. May need an "unless" or maybe "allow_virtual"
+		package { 'centos-stream-release':
+			ensure => installed,
+			notify => Exec['migrate to streams'];
+		}
+		exec { 'migrate to streams':
+			command => '/usr/bin/dnf swap centos-linux-repos centos-stream-repos; /usr/bin/dnf distro-sync -y',
+			refreshonly => true
+		}
 	} else {
 		$python_ver = 'system'
 	}