tested n8n template

This commit is contained in:
CC
2026-05-22 21:59:40 +01:00
parent 7f84f1b2b6
commit 45a704709a
32 changed files with 1027 additions and 69 deletions

View 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)
}

View File

@@ -0,0 +1,7 @@
output "filename" {
value = local_file.inventory.filename
}
output "content" {
value = local_file.inventory.content
}

View File

@@ -0,0 +1,13 @@
variable "filename" {
description = "Path to write the inventory.yml file"
type = string
}
variable "instances" {
description = "Normalized instance map keyed by instance key"
type = map(object({
service_name = string
vm_name = string
ipv4_address = string
}))
}