dont show password rescue password on cmdline and add ability to add authorized_keys file, also let systemd-networkd match on all ethernet devices
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
e427b141c7
commit
05062cabe9
@ -13,21 +13,21 @@ steps:
|
|||||||
environment:
|
environment:
|
||||||
HCLOUD_TOKEN:
|
HCLOUD_TOKEN:
|
||||||
from_secret: hcloud_token
|
from_secret: hcloud_token
|
||||||
SSH_PUBKEY:
|
AUTHORIZED_KEYS_B64:
|
||||||
from_secret: ssh_pubkey
|
from_secret: authorized_keys_b64
|
||||||
commands:
|
commands:
|
||||||
- apk add -U openssh
|
- apk add -U openssh
|
||||||
- wget -O- https://github.com/hetznercloud/cli/releases/latest/download/hcloud-linux-amd64.tar.gz | tar zx
|
- wget -O- https://github.com/hetznercloud/cli/releases/latest/download/hcloud-linux-amd64.tar.gz | tar zx
|
||||||
- ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -q -N ''
|
- ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -q -N ''
|
||||||
- ./hcloud ssh-key delete drone || true
|
- ./hcloud ssh-key delete drone || true
|
||||||
- ./hcloud ssh-key create --name drone --public-key-from-file /root/.ssh/id_ed25519.pub
|
- ./hcloud ssh-key create --name drone --public-key-from-file /root/.ssh/id_ed25519.pub
|
||||||
- ./hcloud server enable-rescue $SERVER_ID --ssh-key drone
|
- ./hcloud server enable-rescue $SERVER_ID --ssh-key drone > /dev/null
|
||||||
- ./hcloud server reset $SERVER_ID
|
- ./hcloud server reset $SERVER_ID
|
||||||
- IP="$(./hcloud server ip "$SERVER_ID")"
|
- IP="$(./hcloud server ip "$SERVER_ID")"
|
||||||
- until ping -c 1 "$IP"; do sleep 5; done
|
- until ping -c 1 "$IP"; do sleep 5; done
|
||||||
- until ssh-keyscan "$IP" > /root/.ssh/known_hosts; do sleep 5; done
|
- until ssh-keyscan "$IP" > /root/.ssh/known_hosts; do sleep 5; done
|
||||||
- scp install-arch.sh root@"$IP":/root/install-arch.sh
|
- scp install-arch.sh root@"$IP":/root/install-arch.sh
|
||||||
- echo "$SSH_PUBKEY" > authorized_keys
|
- echo "$AUTHORIZED_KEYS_B64" | base64 -d > authorized_keys
|
||||||
- scp authorized_keys root@"$IP":/root/authorized_keys
|
- scp authorized_keys root@"$IP":/root/authorized_keys
|
||||||
- ssh root@$IP chmod +x /root/install-arch.sh
|
- ssh root@$IP chmod +x /root/install-arch.sh
|
||||||
- ssh root@$IP /root/install-arch.sh
|
- ssh root@$IP /root/install-arch.sh
|
||||||
|
@ -2,13 +2,9 @@
|
|||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
bchroot() {
|
bchroot() { ./root.x86_64/usr/bin/arch-chroot root.x86_64 $@; }
|
||||||
./root.x86_64/usr/bin/arch-chroot root.x86_64 $@
|
|
||||||
}
|
|
||||||
|
|
||||||
rchroot() {
|
rchroot() { ./root.x86_64/usr/bin/arch-chroot root.x86_64/mnt $@; }
|
||||||
./root.x86_64/usr/bin/arch-chroot root.x86_64/mnt $@
|
|
||||||
}
|
|
||||||
|
|
||||||
curl -o archlinux-bootstrap.tgz "https://ftp.fau.de/archlinux/iso/latest/archlinux-bootstrap-$(date '+%Y.%m.01')-x86_64.tar.gz"
|
curl -o archlinux-bootstrap.tgz "https://ftp.fau.de/archlinux/iso/latest/archlinux-bootstrap-$(date '+%Y.%m.01')-x86_64.tar.gz"
|
||||||
tar xzf archlinux-bootstrap.tgz
|
tar xzf archlinux-bootstrap.tgz
|
||||||
@ -29,8 +25,7 @@ rchroot mkinitcpio -p linux
|
|||||||
rchroot grub-install /dev/sda
|
rchroot grub-install /dev/sda
|
||||||
rchroot grub-mkconfig -o /boot/grub/grub.cfg
|
rchroot grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
|
||||||
IF_NAME="$(udevadm info -q all -p /sys/class/net/eth0 | grep ID_NET_NAME_SLOT | cut -d'=' -f2)"
|
echo -e "[Match]\nType=ether\n\n[Network]\nDHCP=yes\n" > "root.x86_64/mnt/etc/systemd/network/ether.network"
|
||||||
echo -e "[Match]\nName=${IF_NAME}\n\n[Network]\nDHCP=yes\n" > "root.x86_64/mnt/etc/systemd/network/${IF_NAME}.network"
|
|
||||||
rchroot systemctl enable systemd-networkd
|
rchroot systemctl enable systemd-networkd
|
||||||
rchroot systemctl enable systemd-resolved
|
rchroot systemctl enable systemd-resolved
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user