First commit
This commit is contained in:
26
terraform/k3s/outputs.tf
Normal file
26
terraform/k3s/outputs.tf
Normal file
@@ -0,0 +1,26 @@
|
||||
locals {
|
||||
ansible_master_lines = [
|
||||
for name, config in var.k3s_vm_config :
|
||||
"${config.ip} ansible_user=ubuntu ansible_ssh_private_key_file=/home/ryuuji/.ssh/id_rsa ansible_ssh_common_args='-o StrictHostKeyChecking=no'"
|
||||
if config.role == "master"
|
||||
]
|
||||
ansible_worker_lines = [
|
||||
for name, config in var.k3s_vm_config :
|
||||
"${config.ip} ansible_user=ubuntu ansible_ssh_private_key_file=/home/ryuuji/.ssh/id_rsa ansible_ssh_common_args='-o StrictHostKeyChecking=no'"
|
||||
if config.role == "worker"
|
||||
]
|
||||
}
|
||||
|
||||
output "ansible_inventory_k3s" {
|
||||
value = <<EOT
|
||||
[k3s_master]
|
||||
${join("\n", local.ansible_master_lines)}
|
||||
|
||||
[k3s_workers]
|
||||
${join("\n", local.ansible_worker_lines)}
|
||||
|
||||
[k3s_cluster:children]
|
||||
k3s_master
|
||||
k3s_workers
|
||||
EOT
|
||||
}
|
||||
Reference in New Issue
Block a user