tweaked cloud-init

This commit is contained in:
Karim Naufal 2022-02-28 15:35:09 +01:00
parent bb1ba49936
commit 33c62d0c42
2 changed files with 10 additions and 9 deletions

View File

@ -49,15 +49,6 @@ resource "hcloud_server" "server" {
done
EOT
}
provisioner "remote-exec" {
inline = [
# Disable automatic reboot (after transactional updates), and configure the reboot method as kured
"set -ex",
"rebootmgrctl set-strategy off",
"echo 'REBOOT_METHOD=kured' > /etc/transactional-update.conf",
]
}
}
resource "hcloud_server_network" "server" {

View File

@ -17,6 +17,12 @@ write_files:
AuthorizedKeysFile .ssh/authorized_keys
path: /etc/ssh/sshd_config.d/kube-hetzner.conf
# Setting the right reboot mode
- content: |
REBOOT_METHOD=kured
path: /etc/transactional-update.conf
append: true
# Add ssh authorized keys
ssh_authorized_keys:
%{ for key in sshAuthorizedKeys ~}
@ -33,3 +39,7 @@ runcmd:
# Fix hostname (during first boot)
- hostnamectl hostname ${hostname}
# Finishing automatic reboot via Kured setup
- systemctl reload transactional-update
- rebootmgrctl set-strategy off