From a2f4ef8a1d83ac42195ad9c10d95572b44609dcd Mon Sep 17 00:00:00 2001 From: spmfox Date: Mon, 27 May 2024 22:02:53 -0400 Subject: Initial commit of project --- templates/bootcblade-iso.sh.j2 | 15 +++++++++++++++ templates/bootcblade-rebuild.service.j2 | 6 ++++++ templates/bootcblade-rebuild.timer.j2 | 10 ++++++++++ templates/bootcblade.config.toml.j2 | 5 +++++ templates/bootcblade.containerfile.j2 | 24 ++++++++++++++++++++++++ templates/centos-bootc-deploy.sh.j2 | 9 +++++++++ 6 files changed, 69 insertions(+) create mode 100644 templates/bootcblade-iso.sh.j2 create mode 100644 templates/bootcblade-rebuild.service.j2 create mode 100644 templates/bootcblade-rebuild.timer.j2 create mode 100644 templates/bootcblade.config.toml.j2 create mode 100644 templates/bootcblade.containerfile.j2 create mode 100644 templates/centos-bootc-deploy.sh.j2 (limited to 'templates') diff --git a/templates/bootcblade-iso.sh.j2 b/templates/bootcblade-iso.sh.j2 new file mode 100644 index 0000000..0d276e9 --- /dev/null +++ b/templates/bootcblade-iso.sh.j2 @@ -0,0 +1,15 @@ +#!/bin/bash +podman run \ + --rm \ + -it \ + --privileged \ + --pull=newer \ + --security-opt label=type:unconfined_t \ + -v /root/bootcblade.config.toml:/config.toml \ + -v /root/bootcblade-output:/output \ + -v /var/lib/containers/storage:/var/lib/containers/storage \ + quay.io/centos-bootc/bootc-image-builder:latest \ + --type anaconda-iso \ + --rootfs xfs \ + --local \ + localhost/bootcblade:latest diff --git a/templates/bootcblade-rebuild.service.j2 b/templates/bootcblade-rebuild.service.j2 new file mode 100644 index 0000000..525978a --- /dev/null +++ b/templates/bootcblade-rebuild.service.j2 @@ -0,0 +1,6 @@ +[Unit] +Description=BootcBlade rebuild service + +[Service] +ExecStart=/usr/bin/podman build -t localhost/bootcblade -f /root/bootcblade.containerfile +ExecStartPost=/usr/bin/bash -c "/usr/bin/sleep 10 ; /usr/bin/bootc update && /usr/bin/podman image prune -f" diff --git a/templates/bootcblade-rebuild.timer.j2 b/templates/bootcblade-rebuild.timer.j2 new file mode 100644 index 0000000..cffd275 --- /dev/null +++ b/templates/bootcblade-rebuild.timer.j2 @@ -0,0 +1,10 @@ +[Unit] +Description=bootcblade-rebuild timer + +[Timer] +OnBootSec=60min +OnUnitActiveSec=1w + + +[Install] +WantedBy=timers.target diff --git a/templates/bootcblade.config.toml.j2 b/templates/bootcblade.config.toml.j2 new file mode 100644 index 0000000..2087b70 --- /dev/null +++ b/templates/bootcblade.config.toml.j2 @@ -0,0 +1,5 @@ +[[customizations.user]] +name = "{{ create_user }}" +{{ 'password = "' if create_user_password is defined else ''}}{{ create_user_password if create_user_password is defined else '' }}{{ '"' if create_user_password is defined else '' }} +key = "{{ create_user_ssh_pub }}" +groups = ["wheel"] diff --git a/templates/bootcblade.containerfile.j2 b/templates/bootcblade.containerfile.j2 new file mode 100644 index 0000000..7e5ade6 --- /dev/null +++ b/templates/bootcblade.containerfile.j2 @@ -0,0 +1,24 @@ +FROM quay.io/centos-bootc/centos-bootc:{{ centos_bootc_tag if centos_bootc_tag is defined else 'stream9' }} +RUN mkdir /var/roothome +RUN echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/wheel-passwordless-sudo +RUN dnf -y install epel-release && \ + dnf -y install https://zfsonlinux.org/epel/zfs-release-2-3$(rpm --eval "%{dist}").noarch.rpm && \ + dnf -y install kernel-devel-$(ls /usr/lib/modules) && \ + dnf -y install zfs && \ + dkms build zfs/$(rpm -q --qf '%{VERSION}' zfs) -k $(ls /usr/lib/modules) && \ + dkms install zfs/$(rpm -q --qf '%{VERSION}' zfs) -k $(ls /usr/lib/modules) +RUN dnf -y install vim git podman fish ansible wget && \ + echo "qemu:x:107:107:qemu user:/:/sbin/nologin" >> /etc/passwd && \ + dnf -y install qemu-kvm libvirt virt-install virt-viewer && \ + dnf -y install cockpit cockpit-bridge cockpit-file-sharing cockpit-machines cockpit-pcp cockpit-podman cockpit-storaged cockpit-system +RUN git clone https://github.com/45drives/cockpit-zfs-manager.git /root/cockpit-zfs-manager && \ + cp -r /root/cockpit-zfs-manager/zfs /usr/share/cockpit && \ + rm -r /root/cockpit-zfs-manager +RUN git clone https://github.com/jimsalterjrs/sanoid.git /root/sanoid && \ + cd /root/sanoid && git checkout $(git tag | grep "^v" | tail -n 1) && cp sanoid syncoid findoid sleepymutex /usr/local/sbin && \ + mkdir /etc/sanoid && cp sanoid.defaults.conf /etc/sanoid && touch /etc/sanoid/sanoid.conf && cp sanoid.conf /etc/sanoid/sanoid.example.conf && \ + rm -r /root/sanoid +RUN dnf -y install perl-Data-Dumper perl-Getopt-Long lzop mbuffer mhash pv && \ + PERL_MM_USE_DEFAULT=1 cpan install Capture::Tiny && PERL_MM_USE_DEFAULT=1 cpan install Config::IniFiles +RUN dnf -y install firewalld && \ + systemctl enable firewalld diff --git a/templates/centos-bootc-deploy.sh.j2 b/templates/centos-bootc-deploy.sh.j2 new file mode 100644 index 0000000..2083295 --- /dev/null +++ b/templates/centos-bootc-deploy.sh.j2 @@ -0,0 +1,9 @@ +#!/bin/bash +podman run --rm --privileged \ + --pid=host --security-opt label=type:unconfined_t \ + --volume /dev:/dev \ + --volume /var/lib/containers:/var/lib/containers \ + --volume /:/target \ + --entrypoint bootc \ + quay.io/centos-bootc/centos-bootc:{{ centos_bootc_tag if centos_bootc_tag is defined else 'stream9' }} \ + install to-filesystem --skip-fetch-check --replace=alongside /target --root-ssh-authorized-keys /target/root/.ssh/authorized_keys {{ '' if bootc_acknowledge is false else '--acknowledge-destructive' }} -- cgit