Skip to content

Commit

Permalink
tweaked cloud-init
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticaltech committed Feb 28, 2022
1 parent bb1ba49 commit 33c62d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 0 additions & 9 deletions modules/host/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
10 changes: 10 additions & 0 deletions modules/host/templates/userdata.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ~}
Expand All @@ -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

0 comments on commit 33c62d0

Please sign in to comment.