tested n8n template
This commit is contained in:
26
terraform/modules/proxmox_ansible_inventory/main.tf
Normal file
26
terraform/modules/proxmox_ansible_inventory/main.tf
Normal file
@@ -0,0 +1,26 @@
|
||||
locals {
|
||||
inventory = {
|
||||
all = {
|
||||
vars = {
|
||||
ansible_user = "cloud"
|
||||
}
|
||||
children = {
|
||||
for svc in distinct([for k, v in var.instances : v.service_name]) :
|
||||
svc => {
|
||||
hosts = {
|
||||
for k, v in var.instances :
|
||||
v.vm_name => {
|
||||
ansible_host = v.ipv4_address
|
||||
}
|
||||
if v.service_name == svc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "local_file" "inventory" {
|
||||
filename = var.filename
|
||||
content = yamlencode(local.inventory)
|
||||
}
|
||||
Reference in New Issue
Block a user