pre master
This commit is contained in:
18
agents.tf
18
agents.tf
@@ -8,7 +8,7 @@ resource "hcloud_server" "agents" {
|
||||
location = var.location
|
||||
ssh_keys = [hcloud_ssh_key.k3s.id]
|
||||
firewall_ids = [hcloud_firewall.k3s.id]
|
||||
placement_group_id = hcloud_placement_group.k3s_placement_group.id
|
||||
placement_group_id = hcloud_placement_group.k3s.id
|
||||
|
||||
|
||||
labels = {
|
||||
@@ -53,7 +53,7 @@ resource "hcloud_server" "agents" {
|
||||
command = <<-EOT
|
||||
until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null
|
||||
do
|
||||
echo Waiting for ssh to be ready...
|
||||
echo "Waiting for ssh to be ready..."
|
||||
sleep 2
|
||||
done
|
||||
EOT
|
||||
@@ -98,10 +98,20 @@ resource "hcloud_server" "agents" {
|
||||
provisioner "remote-exec" {
|
||||
inline = [
|
||||
"set -ex",
|
||||
# set the hostname in a persistent fashion
|
||||
"hostnamectl set-hostname ${self.name}",
|
||||
# first we disable automatic reboot (after transactional updates), and configure the reboot method as kured
|
||||
"rebootmgrctl set-strategy off && echo 'REBOOT_METHOD=kured' > /etc/transactional-update.conf",
|
||||
# then turn on k3s and join the cluster
|
||||
"systemctl --now enable k3s-agent",
|
||||
# then we start k3s agent and join the cluster
|
||||
"systemctl enable k3s-server",
|
||||
<<-EOT
|
||||
until systemctl status k3s-server > /dev/null
|
||||
do
|
||||
systemctl start k3s-server
|
||||
echo "Starting k3s-agent and joining the cluster..."
|
||||
sleep 2
|
||||
done
|
||||
EOT
|
||||
]
|
||||
|
||||
connection {
|
||||
|
Reference in New Issue
Block a user