many things

This commit is contained in:
Chris Cowley 2024-08-04 16:16:53 +02:00
parent 18a08d623b
commit a7fad6c9c6
43 changed files with 1246 additions and 54 deletions

View file

@ -0,0 +1,7 @@
[Unit]
Description=Clean k3s images
[Service]
Type=oneshot
Environment="HOME=/root/"
ExecStart=/opt/k3s-image-clean.sh

View file

@ -0,0 +1,11 @@
[Unit]
Description=Run daily image cleanup
[Timer]
OnCalendar=daily
AccuracySec=1h
Persistent=true
RandomizedDelaySec=6000
[Install]
WantedBy=timers.target

View file

@ -0,0 +1,18 @@
[Unit]
Description=Run K3s script
Wants = network-online.target
After = network-online.target
ConditionPathExists=/opt/k3s-agent-install.sh
ConditionPathExists=/var/.k3s-selinux-installed
ConditionPathExists=!/opt/bin/k3s
[Service]
Type=forking
TimeoutStartSec=0
RemainAfterExit=no
KillMode=process
Environment="K3S_TOKEN=${k3s_token}"
ExecStart=/usr/bin/sh -c "/opt/k3s-agent-install.sh"
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,19 @@
[Unit]
Description=Run K3s agent script
Wants=network-online.target
After=network-online.target
ConditionPathExists=/opt/k3s-agent-install.sh
ConditionPathExists=/var/.k3s-selinux-installed
ConditionPathExists=!/opt/bin/k3s
[Service]
Type=oneshot
TimeoutStartSec=0
RemainAfterExit=no
KillMode=process
Environment="K3S_TOKEN=${k3s_token}"
Environment="K3S_URL=https://kubemaster0.lab.cowley.tech:6443"
ExecStart=/usr/bin/sh -c "/opt/k3s-agent-install.sh"
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,19 @@
[Unit]
Description=Run K3s script
Wants = network-online.target
After = network-online.target
ConditionPathExists=/etc/rancher/k3s/config.yaml
ConditionPathExists=/opt/k3s-agent-install.sh
ConditionPathExists=!/opt/bin/k3s
[Service]
Type=forking
TimeoutStartSec=0
RemainAfterExit=yes
KillMode=process
Environment="K3S_TOKEN=secret_edgecluster_token"
Environment="INSTALL_K3S_EXEC=agent"
ExecStart=/usr/bin/sh -c "/opt/k3s-agent-install.sh"
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,17 @@
[Unit]
Description=Run K3s prereqs
Wants = network-online.target
After = network-online.target
ConditionPathExists=/opt/k3s-prereqs.sh
ConditionPathExists=!/var/.k3s-selinux-installed
ConditionPathExists=!/opt/bin/k3s
[Service]
Type=forking
TimeoutStartSec=0
RemainAfterExit=yes
KillMode=process
ExecStart=/usr/bin/sh -c "/opt/k3s-prereqs.sh"
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,17 @@
[Unit]
Description=Run K3s script
Wants = network-online.target
After = network-online.target
ConditionPathExists=/opt/k3s-server-install.sh
ConditionPathExists=!/usr/local/bin/k3s
[Service]
Type=forking
TimeoutStartSec=0
RemainAfterExit=no
KillMode=process
Environment="K3S_TOKEN=${k3s_token}"
ExecStart=/usr/bin/sh -c "/opt/k3s-server-install.sh"
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,23 @@
[Unit]
Description=Install KVM
Wants = network-online.target
After = network-online.target
# We run before `zincati.service` to avoid conflicting rpm-ostree
# transactions.
Before=zincati.service
ConditionPathExists=!/var/lib/%N.stamp
[Service]
Type=oneshot
RemainAfterExit=yes
# `--allow-inactive` ensures that rpm-ostree does not return an error
# if the package is already installed. This is useful if the package is
# added to the root image in a future Fedora CoreOS release as it will
# prevent the service from failing.
ExecStart=/usr/bin/rpm-ostree install --apply-live --allow-inactive qemu-system-x86-core
ExecStart=/bin/touch /var/lib/%N.stamp
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,25 @@
[Unit]
Description=Run Minio Container
Wants = network-online.target
After = network-online.target
[Service]
TimeoutStartSec=0
ExecStartPre=-/bin/podman kill minio
ExecStartPre=-/bin/podman rm minio
ExecStartPre=/bin/podman pull quay.io/minio/minio:RELEASE.2024-03-07T00-43-48Z-cpuv1
ExecStart=/bin/podman run \
-t \
--rm \
-p 9000:9000 -p 9001:9001 \
-v /var/lib/minio:/mnt/data/:Z \
-v /etc/default/minio:/etc/config.env:Z \
-e "MINIO_CONFIG_ENV_FILE=/etc/config.env" \
--name "minio" \
quay.io/minio/minio:RELEASE.2024-03-07T00-43-48Z-cpuv1 server --console-address ":9001"
ExecStop=/bin/podman stop minio
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,22 @@
[Unit]
Description=Run Prometheus Node Exporter
Wants = network-online.target
After = network-online.target
[Service]
TimeoutStartSec=0
ExecStartPre=-/bin/podman kill node-exporter
ExecStartPre=-/bin/podman rm node-exporter
ExecStartPre=/bin/podman pull quay.io/prometheus/node-exporter:latest
ExecStart=/bin/podman run \
--pid=host \
--net=host \
-v "/:/host:ro,rslave" \
--name="node-exporter" \
quay.io/prometheus/node-exporter:latest '--path.rootfs=/host'
ExecStop=/bin/podman stop node-exporter
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,22 @@
[Unit]
Description=Run QEMU guest agent container
Wants = network-online.target
After = network-online.target
[Service]
TimeoutStartSec=0
ExecStartPre=-/bin/podman kill qemu-ga
ExecStartPre=-/bin/podman rm qemu-ga
ExecStartPre=/bin/podman pull docker.io/linuxkit/qemu-ga:v0.7
ExecStart=/bin/podman run --privileged \
--rm \
--pid=host \
--ipc=host \
--net=host \
-v /dev:/dev \
docker.io/linuxkit/qemu-ga:v0.7 /usr/bin/qemu-ga -v m virtio-serial
ExecStop=/bin/podman stop qemu-ga
[Install]
WantedBy=multi-user.target