Moved template files to subdirectory

This commit is contained in:
2023-11-01 22:52:45 +01:00
parent 9178a00ba7
commit 6dff1d4241
5 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
output "ansible_inventory" {
value = templatefile("${path.module}/inventory.tftpl", {
value = templatefile("${path.module}/templates/inventory.tftpl", {
devops = hcloud_server.server_devops.ipv4_address, k8s_servers = [hcloud_server.server_k8s_test.ipv4_address]
})
}
+7 -4
View File
@@ -154,7 +154,7 @@ resource "hcloud_server" "server_devops" {
}
firewall_ids = [hcloud_firewall.basic-firewall.id]
ssh_keys = [data.hcloud_ssh_key.macos.id]
user_data = file("cloud-init.yaml")
user_data = file("${path.module}/templates/cloud-init.tftpl")
shutdown_before_deletion = true
lifecycle {
@@ -196,9 +196,12 @@ resource "hcloud_server" "server_k8s_test" {
labels = {
"kubernetes" : "yes"
}
firewall_ids = [hcloud_firewall.basic-firewall.id, hcloud_firewall.k8s-firewall.id]
ssh_keys = [data.hcloud_ssh_key.macos.id]
user_data = file("cloud-init.yaml")
firewall_ids = [hcloud_firewall.basic-firewall.id, hcloud_firewall.k8s-firewall.id]
ssh_keys = [data.hcloud_ssh_key.macos.id]
user_data = templatefile("${path.module}/templates/cloud-init-k8s.tftpl", {
node_ip : "10.0.0.2",
cluster_token : "DkZaYY5JUAptUtq4HbXVb2x4HHD3HP7U"
})
shutdown_before_deletion = true
network {
@@ -31,5 +31,7 @@ runcmd:
- apt install /tmp/hc-utils_0.0.4-1_all.deb
- mkdir -p /var/snap/microk8s/common/
- curl https://repo.2martens.de/files/microk8s-config.yaml -o /var/snap/microk8s/common/.microk8s.yaml
- sed -i -e '/\$NODE_IP/s//${node_ip}/' /var/snap/microk8s/common/.microk8s.yaml
- sed -i -e '/\$CLUSTER_TOKEN/s//${cluster_token}/' /var/snap/microk8s/common/.microk8s.yaml
- snap install microk8s --channel 1.28-strict/stable
- reboot