Skip to content

Commit

Permalink
Add template
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Gedon <[email protected]>
  • Loading branch information
nodeg committed Sep 11, 2024
1 parent 1d24a93 commit e7bbf1c
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 38 deletions.
123 changes: 86 additions & 37 deletions backend_modules/libvirt/host/combustion
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
# combustion: network prepare
# see https://github.com/openSUSE/combustion#simple-example
# combustion: network

%{ if image == "leapmicro55o" }
# combustion: network prepare
set -euxo pipefail

function nm_config() {
Expand Down Expand Up @@ -30,48 +32,109 @@ if [ "$${1-}" = "--prepare" ]; then
nm_config 2 eth1 manual
exit 0
fi
%{ endif }

# Redirect output to log file
exec > >(exec tee -a /var/log/combustion) 2>&1

%{ if image == "leapmicro55o" }
# Name the Network Manager connections (final phase on real filesystem)
nm_config 1 eth0 auto
nm_config 2 eth1 manual
%{ endif }
%{ endif } # leapmicro55o


# Redirect output to log file
exec > >(exec tee -a /var/log/combustion) 2>&1

# Set linux as password for root
echo 'root:$6$3aQC9rrDLHiTf1yR$NoKe9tko0kFIpu0rQ2y/OzOOtbVvs0Amr2bx0T4cGf6aq8PG74EmVy8lSDJdbLVVFpOSzwELWyReRCiPHa7DG0' | chpasswd -e

# SL Micro6: Add PermitRootLogin to sshd config
%{ if image == "slmicro60o" }
echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/root.conf
echo "ChallengeResponseAuthentication yes" >> /etc/ssh/sshd_config.d/root.conf
%{ endif }

# Add a public ssh key and enable sshd
systemctl enable sshd.service

# Add the GPG keys
${ gpg_keys }

# Add repositories
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/SUSE:/CA/15.5/ ca_suse

%{ if image == "slemicro54" }
### SLE Micro ###
%{ if image == "slemicro51" }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/SUSE:/CA/SLE_15_SP1/ ca_suse
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/SUSE/Products/SUSE-MicroOS/5.1/x86_64/product/ micro_pool_repo
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/SUSE/Updates/SUSE-MicroOS/5.1/x86_64/update/ micro_update_repo

%{ if testsuite }
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs"}/SUSE/Products/SLE-Module-Basesystem/15-SP4/x86_64/product os_pool_repo
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/systemsmanagement:/Uyuni:/Test-Packages:/Pool/rpm/ test_repo_rpm_pool
%{ endif }
%{ endif } # slemicro51


%{ if image == "slemicro52" }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/SUSE:/CA/SLE_15_SP2/ ca_suse
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/SUSE/Products/SUSE-MicroOS/5.2/x86_64/product/ micro_pool_repo
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/SUSE/Updates/SUSE-MicroOS/5.2/x86_64/update/ micro_update_repo

%{ if testsuite }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/systemsmanagement:/Uyuni:/Test-Packages:/Pool/rpm/ test_repo_rpm_pool
%{ endif }
%{ endif } # slemicro52


%{ if image == "slemicro53" }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/SUSE:/CA/SLE_15_SP3/ ca_suse
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/SUSE/Products/SLE-Micro/5.3/x86_64/product/ micro_pool_repo
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/SUSE/Updates/SLE-Micro/5.3/x86_64/update/ micro_update_repo

%{ if testsuite }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/systemsmanagement:/Uyuni:/Test-Packages:/Pool/rpm/ test_repo_rpm_pool
%{ endif }
%{ endif } # slemicro53


%{ if image == "slemicro54" }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/SUSE:/CA/SLE_15_SP4/ ca_suse
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/SUSE/Products/SLE-Micro/5.4/x86_64/product/ micro_pool_repo
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/SUSE/Updates/SLE-Micro/5.4/x86_64/update/ micro_update_repo

%{ if testsuite }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/systemsmanagement:/Uyuni:/Test-Packages:/Pool/rpm/ test_repo_rpm_pool
%{ endif }
%{ endif } # slemicro54


# TODO
#%{ if image == "slemicro55" }
#%{ endif } # slemicro55


# shared SLE Micro 5.x client tools
%{ if image == "slemicro55" || image == "slemicro54" || image == "slemicro53" || image == "slemicro52" || image == "slemicro51" }
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs" }/Devel:/Galaxy:/Manager:/Head:/SLE15-SUSE-Manager-Tools/images/repo/SLE-15-Manager-Tools-POOL-x86_64-Media1/ tools_pool_repo
%{ endif }


%{ if image == "slmicro60o" }
# SL Micro 6.x does not allow this anymore
echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/root.conf
echo "ChallengeResponseAuthentication yes" >> /etc/ssh/sshd_config.d/root.conf

zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/SUSE:/CA/SLE_15_SP6/ ca_suse
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs"}/SUSE/Products/SL-Micro/6.0/x86_64/product/ os_pool_repo

# SL Micro 6.0 is being used in both Uyuni and SUSE Manager
# we do not support Leap Micro 6.0, yet, even in Uyuni
%{ if product_version == "uyuni-master" || product_version == "uyuni-released" || product_version == "uyuni-pr" }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org"}/repositories/systemsmanagement:/Uyuni:/Master:/SLMicro6-Uyuni-Client-Tools/SL-Micro6/ client_tools_repo
%{ else }
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs"}/SUSE/Products/SUSE-Manager-Tools-For-SL-Micro/6/x86_64/product/ tools_pool_repo
%{ endif }

%{ if testsuite }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/systemsmanagement:/Uyuni:/Test-Packages:/Pool/rpm/ test_repo_rpm_pool
%{ endif }
%{ endif } # end of image == "slmicro60o" block


%{ endif } # end of image == "slemicro54-ign" block

### openSUSE Leap Micro ###
%{ if image == "leapmicro55o" }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/systemsmanagement:/Uyuni:/Master:/openSUSE_Leap_15-Uyuni-Client-Tools/openSUSE_Leap_15.0/ client_tools_repo
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/SUSE:/CA/15.5/ ca_suse

%{ if container_server || container_proxy }
%{ if product_version == "uyuni-master" || product_version == "uyuni-pr" }
Expand All @@ -81,9 +144,9 @@ zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repos
%{ endif }
%{ endif }


%{ if testsuite }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/systemsmanagement:/Uyuni:/Test-Packages:/Pool/rpm/ test_repo_rpm_pool

# Leap repos are required to install expect
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/distribution/leap/15.5/repo/oss/ leap_pool_repo
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/update/leap/15.5/oss/ leap_update_repo
Expand All @@ -92,24 +155,10 @@ zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/updat
%{ if container_runtime == "k3s" }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/update/leap/15.5/sle/ sle_update_repo
%{ endif }
%{ endif } # end of image == "leapmicro55o" block

%{ if image == "slmicro60o" }
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs"}/SUSE/Products/SL-Micro/6.0/x86_64/product/ os_pool_repo

# SL Micro 6.0 is being used in both Uyuni and SUSE Manager
# we do not support yet Leap Micro 6.0, even in Uyuni
%{ if product_version == "uyuni-master" || product_version == "uyuni-released" || product_version == "uyuni-pr" }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org"}/repositories/systemsmanagement:/Uyuni:/Master:/SLMicro6-Uyuni-Client-Tools/SL-Micro6/ client_tools_repo
%{ else }
zypper ar http://${ use_mirror_images ? mirror : "download.suse.de/ibs"}/SUSE/Products/SUSE-Manager-Tools-For-SL-Micro/6/x86_64/product/ tools_pool_repo
%{ endif }
%{ endif } # end leapmicro55o

%{ if testsuite }
zypper ar http://${ use_mirror_images ? mirror : "download.opensuse.org" }/repositories/systemsmanagement:/Uyuni:/Test-Packages:/Pool/rpm/ test_repo_rpm_pool
%{ endif }
%{ endif } # end of image == "slmicro60o" block

## additional repositories from the terraform file
for i in ${additional_repos}; do
name=$(echo $i | cut -d= -f1)
url=$(echo $i | cut -d= -f2)
Expand All @@ -120,7 +169,7 @@ for i in ${additional_repos}; do
%{ endif }
done

# Install packages
#### Install packages ####
PACKAGES="qemu-guest-agent avahi ca-certificates"

%{ if container_runtime == "podman" }
Expand Down Expand Up @@ -162,4 +211,4 @@ zypper --non-interactive install $PACKAGES
echo "Configured with combustion" > /etc/issue.d/combustion

# Close outputs and wait for tee to finish.
exec 1>&- 2>&-; wait;
exec 1>&- 2>&-; wait;
2 changes: 1 addition & 1 deletion salt/minion/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include:
- minion.reflector

{% if not grains['osfullname'] in ['SLE Micro', 'SL-Micro'] %}
# Dependencies already satisfied by cloud-init/combustion for SLEM 5.5 and Leap Micro 5.5
# Dependencies already satisfied by cloud-init/combustion
minion_package:
pkg.installed:
{% if grains['install_salt_bundle'] %}
Expand Down

0 comments on commit e7bbf1c

Please sign in to comment.