summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Janczyk2023-08-08 17:57:34 +0200
committerMichael Janczyk2023-08-08 17:57:34 +0200
commit3022f353ce7ec3e5f29d46bf973eef2f034b9ce2 (patch)
tree1791bcc0e8aa5284864302261a7adc11c3d5ae2f
parentMakefile: correct tabs and spaces to work correctly. (diff)
downloadpacker-templates-3022f353ce7ec3e5f29d46bf973eef2f034b9ce2.tar.gz
packer-templates-3022f353ce7ec3e5f29d46bf973eef2f034b9ce2.tar.xz
packer-templates-3022f353ce7ec3e5f29d46bf973eef2f034b9ce2.zip
add support for alma/centos/rocky 8.
-rw-r--r--hcl2/alma-8-x86_64/base.pkrvars.hcl19
-rw-r--r--hcl2/alma-8-x86_64/http/anaconda-ks.cfg56
-rw-r--r--hcl2/centos-8-x86_64/base.pkrvars.hcl19
-rw-r--r--hcl2/centos-8-x86_64/http/anaconda-ks.cfg57
-rw-r--r--hcl2/rocky-8-x86_64/base.pkrvars.hcl19
-rw-r--r--hcl2/rocky-8-x86_64/http/anaconda-ks.cfg56
6 files changed, 226 insertions, 0 deletions
diff --git a/hcl2/alma-8-x86_64/base.pkrvars.hcl b/hcl2/alma-8-x86_64/base.pkrvars.hcl
new file mode 100644
index 0000000..7178ea3
--- /dev/null
+++ b/hcl2/alma-8-x86_64/base.pkrvars.hcl
@@ -0,0 +1,19 @@
+# Read the variables type constraints documentation
+# https://www.packer.io/docs/templates/hcl_templates/variables#type-constraints
+# for more info.
+
+# Following variables will be defined though Makefile:
+# http_dir=$(@D)/http
+# output_directory=builds/$(@D)/base
+# playbook=$(ANSIBLE_DIR_CORE)/slx-builder.yml
+# vm_name=$(@D)
+
+boot_command = [
+ "<esc><wait>",
+ "linux inst.cmdline biosdevname=0 net.ifnames=0 ",
+ "rootpw=secret ",
+ "inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/anaconda-ks.cfg",
+ "<enter>"
+ ]
+iso_checksum = "file:https://mirror1.hs-esslingen.de/pub/Mirrors/almalinux/8/isos/x86_64/CHECKSUM"
+iso_url = "https://mirror1.hs-esslingen.de/pub/Mirrors/almalinux/8/isos/x86_64/AlmaLinux-8-latest-x86_64-minimal.iso"
diff --git a/hcl2/alma-8-x86_64/http/anaconda-ks.cfg b/hcl2/alma-8-x86_64/http/anaconda-ks.cfg
new file mode 100644
index 0000000..47ac4cd
--- /dev/null
+++ b/hcl2/alma-8-x86_64/http/anaconda-ks.cfg
@@ -0,0 +1,56 @@
+clearpart --none --initlabel
+bootloader --location=mbr --boot-drive=sda
+part biosboot --fstype=biosboot --ondisk=sda --size=1
+part / --fstype=xfs --asprimary --ondisk=sda --grow --label=SLX_SYS
+lang en_US.UTF-8
+keyboard --vckeymap=us --xlayouts='us'
+timezone Europe/Berlin --isUtc --nontp
+text
+reboot
+
+%packages
+@core
+%end
+
+%pre --interpreter=/usr/bin/perl
+use strict;
+use warnings;
+use feature 'say';
+
+open(my $fp, '<', '/proc/cmdline') or die $!;
+chomp(my $line = scalar <$fp>);
+close($fp);
+
+my @tokens = map {/^rootpw=(.*)/ ? $1 : () }
+ split / /, $line;
+
+exit if @tokens < 1;
+
+my $pw = crypt($tokens[0], "\$6\$1U9v8hxj6xmYNJBA\$");
+
+open($fp, '>', '/tmp/setup-root-pass') or die $!;
+say $fp "rootpw --iscrypted $pw";
+close($fp);
+%end
+
+%include /tmp/setup-root-pass
+
+%post --erroronfail
+set -x
+parted -s /dev/sda -- name 2 SLX_SYS
+dnf -y install epel-release
+dnf -y update
+dnf clean all
+
+# allow root login for ansible
+sed -i 's,^[[:blank:]]*#*PermitRootLogin.*,PermitRootLogin yes,g' /etc/ssh/sshd_config
+
+ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
+cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
+DEVICE="eth0"
+BOOTPROTO="dhcp"
+ONBOOT="yes"
+TYPE="Ethernet"
+EOF
+set +x
+%end
diff --git a/hcl2/centos-8-x86_64/base.pkrvars.hcl b/hcl2/centos-8-x86_64/base.pkrvars.hcl
new file mode 100644
index 0000000..8615dc8
--- /dev/null
+++ b/hcl2/centos-8-x86_64/base.pkrvars.hcl
@@ -0,0 +1,19 @@
+# Read the variables type constraints documentation
+# https://www.packer.io/docs/templates/hcl_templates/variables#type-constraints
+# for more info.
+
+# Following variables will be defined though Makefile:
+# http_dir=$(@D)/http
+# output_directory=builds/$(@D)/base
+# playbook=$(ANSIBLE_DIR_CORE)/slx-builder.yml
+# vm_name=$(@D)
+
+boot_command = [
+ "<esc><wait>",
+ "linux inst.cmdline biosdevname=0 net.ifnames=0 ",
+ "rootpw=secret ",
+ "inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/anaconda-ks.cfg",
+ "<enter>"
+ ]
+iso_checksum = "file:https://mirror1.hs-esslingen.de/pub/Mirrors/centos/8-stream/isos/x86_64/CHECKSUM"
+iso_url = "https://mirror1.hs-esslingen.de/pub/Mirrors/centos/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-boot.iso"
diff --git a/hcl2/centos-8-x86_64/http/anaconda-ks.cfg b/hcl2/centos-8-x86_64/http/anaconda-ks.cfg
new file mode 100644
index 0000000..7ca1731
--- /dev/null
+++ b/hcl2/centos-8-x86_64/http/anaconda-ks.cfg
@@ -0,0 +1,57 @@
+clearpart --none --initlabel
+bootloader --location=mbr --boot-drive=sda
+part biosboot --fstype=biosboot --ondisk=sda --size=1
+part / --fstype=xfs --asprimary --ondisk=sda --grow --label=SLX_SYS
+url --mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=baseos
+lang en_US.UTF-8
+keyboard --vckeymap=us --xlayouts='us'
+timezone Europe/Berlin --isUtc --nontp
+text
+reboot
+
+%packages
+@core
+%end
+
+%pre --interpreter=/usr/bin/perl
+use strict;
+use warnings;
+use feature 'say';
+
+open(my $fp, '<', '/proc/cmdline') or die $!;
+chomp(my $line = scalar <$fp>);
+close($fp);
+
+my @tokens = map {/^rootpw=(.*)/ ? $1 : () }
+ split / /, $line;
+
+exit if @tokens < 1;
+
+my $pw = crypt($tokens[0], "\$6\$1U9v8hxj6xmYNJBA\$");
+
+open($fp, '>', '/tmp/setup-root-pass') or die $!;
+say $fp "rootpw --iscrypted $pw";
+close($fp);
+%end
+
+%include /tmp/setup-root-pass
+
+%post --erroronfail
+set -x
+parted -s /dev/sda -- name 2 SLX_SYS
+dnf -y install epel-release
+dnf -y update
+dnf clean all
+
+# allow root login for ansible
+sed -i 's,^[[:blank:]]*#*PermitRootLogin.*,PermitRootLogin yes,g' /etc/ssh/sshd_config
+
+ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
+cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
+DEVICE="eth0"
+BOOTPROTO="dhcp"
+ONBOOT="yes"
+TYPE="Ethernet"
+EOF
+set +x
+%end
diff --git a/hcl2/rocky-8-x86_64/base.pkrvars.hcl b/hcl2/rocky-8-x86_64/base.pkrvars.hcl
new file mode 100644
index 0000000..7c9e283
--- /dev/null
+++ b/hcl2/rocky-8-x86_64/base.pkrvars.hcl
@@ -0,0 +1,19 @@
+# Read the variables type constraints documentation
+# https://www.packer.io/docs/templates/hcl_templates/variables#type-constraints
+# for more info.
+
+# Following variables will be defined though Makefile:
+# http_dir=$(@D)/http
+# output_directory=builds/$(@D)/base
+# playbook=$(ANSIBLE_DIR_CORE)/slx-builder.yml
+# vm_name=$(@D)
+
+boot_command = [
+ "<esc><wait>",
+ "linux inst.cmdline biosdevname=0 net.ifnames=0 ",
+ "rootpw=secret ",
+ "inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/anaconda-ks.cfg",
+ "<enter>"
+ ]
+iso_checksum = "file:https://mirror1.hs-esslingen.de/pub/Mirrors/rocky/8/isos/x86_64/CHECKSUM"
+iso_url = "https://mirror1.hs-esslingen.de/pub/Mirrors/rocky/8/isos/x86_64/Rocky-x86_64-minimal.iso"
diff --git a/hcl2/rocky-8-x86_64/http/anaconda-ks.cfg b/hcl2/rocky-8-x86_64/http/anaconda-ks.cfg
new file mode 100644
index 0000000..47ac4cd
--- /dev/null
+++ b/hcl2/rocky-8-x86_64/http/anaconda-ks.cfg
@@ -0,0 +1,56 @@
+clearpart --none --initlabel
+bootloader --location=mbr --boot-drive=sda
+part biosboot --fstype=biosboot --ondisk=sda --size=1
+part / --fstype=xfs --asprimary --ondisk=sda --grow --label=SLX_SYS
+lang en_US.UTF-8
+keyboard --vckeymap=us --xlayouts='us'
+timezone Europe/Berlin --isUtc --nontp
+text
+reboot
+
+%packages
+@core
+%end
+
+%pre --interpreter=/usr/bin/perl
+use strict;
+use warnings;
+use feature 'say';
+
+open(my $fp, '<', '/proc/cmdline') or die $!;
+chomp(my $line = scalar <$fp>);
+close($fp);
+
+my @tokens = map {/^rootpw=(.*)/ ? $1 : () }
+ split / /, $line;
+
+exit if @tokens < 1;
+
+my $pw = crypt($tokens[0], "\$6\$1U9v8hxj6xmYNJBA\$");
+
+open($fp, '>', '/tmp/setup-root-pass') or die $!;
+say $fp "rootpw --iscrypted $pw";
+close($fp);
+%end
+
+%include /tmp/setup-root-pass
+
+%post --erroronfail
+set -x
+parted -s /dev/sda -- name 2 SLX_SYS
+dnf -y install epel-release
+dnf -y update
+dnf clean all
+
+# allow root login for ansible
+sed -i 's,^[[:blank:]]*#*PermitRootLogin.*,PermitRootLogin yes,g' /etc/ssh/sshd_config
+
+ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
+cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
+DEVICE="eth0"
+BOOTPROTO="dhcp"
+ONBOOT="yes"
+TYPE="Ethernet"
+EOF
+set +x
+%end