Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions environments/site/tofu/inventory.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ${cluster_name}_${group_name}:
image_id: ${ node.image_id }
networks: ${jsonencode({for n in node.network: n.name => {"fixed_ip_v4": n.fixed_ip_v4, "fixed_ip_v6": n.fixed_ip_v6}})}
node_fqdn: ${login_groups[group_name]["fqdns"][nodename]}
node_fip: ${login_groups[group_name]["nodegroup_fips"][nodename]}
%{ endfor ~}

${group_name}:
Expand Down Expand Up @@ -77,6 +78,7 @@ ${cluster_name}_${group_name}:
instance_id: ${ node.id }
networks: ${jsonencode({for n in node.network: n.name => {"fixed_ip_v4": n.fixed_ip_v4, "fixed_ip_v6": n.fixed_ip_v6}})}
node_fqdn: ${additional_groups[group_name]["fqdns"][nodename]}
node_fip: ${additional_groups[group_name]["nodegroup_fips"][nodename]}
%{ endfor ~}
${group_name}:
children:
Expand Down
9 changes: 9 additions & 0 deletions environments/site/tofu/node_group/nodes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ locals {
}
)
}
# Map node names to floating IPs from the list var.fip_addresses by index
nodegroup_fips = {
for idx, n in var.nodes :
n => length(var.fip_addresses) > idx ? var.fip_addresses[idx] : ""
}

baremetal_az = var.availability_zone != null ? var.availability_zone : "nova"
}
Expand Down Expand Up @@ -229,3 +234,7 @@ output "image_id" {
output "fqdns" {
value = local.fqdns
}

output "nodegroup_fips" {
value = local.nodegroup_fips
}
Loading