diff --git a/modules/host/main.tf b/modules/host/main.tf index 6e0f41d..99d4069 100644 --- a/modules/host/main.tf +++ b/modules/host/main.tf @@ -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" { diff --git a/modules/host/templates/userdata.yaml.tpl b/modules/host/templates/userdata.yaml.tpl index 0e4ef50..c685b6e 100644 --- a/modules/host/templates/userdata.yaml.tpl +++ b/modules/host/templates/userdata.yaml.tpl @@ -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 \ No newline at end of file