Compare commits

...

2 Commits

Author SHA1 Message Date
Dustin 0f091f9dfe autoprovision: Install dch-autoprovision RPM
infra/kickstart/pipeline/head This commit looks good Details
The `notify-online` script and corresponding systemd unit are now
available in an RPM.  This allowes them to be installed in different
scenarios, such as image builds, that do not use Anaconda/kickstart.
2025-08-14 10:13:38 -05:00
Dustin d8118e0fce autoprovision: split script+unit into separate files
Now that we're using Jinja to render the kickstart scripts, we can
separate out scripts, systemd unit files, etc. into their own files and
`include` them.  This makes editing them much easier, especially since
syntax highlighting will work correctly.
2025-07-26 07:20:01 -05:00
5 changed files with 22 additions and 29 deletions

7
autoprovision.ks.j2 Normal file
View File

@ -0,0 +1,7 @@
%packages
dch-autoprovision
%end
%post
systemctl enable --no-reload notify-online.service
%end

View File

@ -2,4 +2,4 @@
ignoredisk --only-use /dev/mmcblk0 ignoredisk --only-use /dev/mmcblk0
{% include "fedora-disk-dch.ks" %} {% include "fedora-disk-dch.ks" %}
{% include "fedora-rpi-common.ks.j2" %} {% include "fedora-rpi-common.ks.j2" %}
{% include "autoprovision.ks" %} {% include "autoprovision.ks.j2" %}

View File

@ -16,4 +16,4 @@ qemu-guest-agent
-fwupd -fwupd
%end %end
{% include "autoprovision.ks" %} {% include "autoprovision.ks.j2" %}

View File

@ -1,26 +1,3 @@
%post
cat > /root/.ssh/authorized_keys <<EOF
expiry-time="$(date -d +1hour +%Y%m%d%H%M)",restrict,pty ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICoOO/ZYMxRgmyvqZwGN3NM5pHyh3NBdC7iZrXIopt93 Host Provisioner
EOF
cat > /usr/local/libexec/notify-online.sh <<'EOF'
#!/bin/sh
set -- \
-F "hostname=$(hostname -f)" \
-F 'sshkeys=<-;type=text/plain'
fw_cfg=/sys/firmware/qemu_fw_cfg/by_name/opt/dch/cfg-branch/raw
if [ -r "${fw_cfg}" ]; then
set -- "$@" -F branch="$(cat "${fw_cfg}")"
fi
cat /etc/ssh/ssh_host_*_key.pub \
| curl -fsS https://webhooks.pyrocufflink.blue/host/online "$@"
EOF
chmod +x /usr/local/libexec/notify-online.sh
cat > /etc/systemd/system/notify-online.service <<'EOF'
[Unit] [Unit]
Description=Notify infrastructure services that this host is online Description=Notify infrastructure services that this host is online
ConditionFirstBoot=yes ConditionFirstBoot=yes
@ -63,7 +40,3 @@ SystemCallFilter=~@privileged @resources
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF
systemctl enable --no-reload notify-online.service
%end

13
notify-online.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
set -- \
-F "hostname=$(hostname -f)" \
-F 'sshkeys=<-;type=text/plain'
fw_cfg=/sys/firmware/qemu_fw_cfg/by_name/opt/dch/cfg-branch/raw
if [ -r "${fw_cfg}" ]; then
set -- "$@" -F branch="$(cat "${fw_cfg}")"
fi
cat /etc/ssh/ssh_host_*_key.pub \
| curl -fsS https://webhooks.pyrocufflink.blue/host/online "$@"