-
When I used the Telemate provider I was able to retrieve the IPV4 address assigned to the VM (whether via DHCP or static) and I used that to create my ansible hosts file. I am trying to replicate that. This is an example : data "template_file" "templs" {
template = file("./templates/hosts.tpl")
vars = {
master_ip = "${join("\n", [for instance in proxmox_vm_qemu.master_vms : join("", [**instance.default_ipv4_address**, " ansible_user=", var.user["name"]])])}"
node_ip = "${join("\n", [for instance in proxmox_vm_qemu.slave_vms : join("", [**instance.default_ipv4_address**, " ansible_user=", var.user["name"]])])}"
}
} Is there some way to replicate this in bgs provider? If not could I request it please |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I believe you can use
It is basically a list of lists of IP addresses that you can pick the required IP from, depends on your network configuration. But make sure the qemu agent is installed and enabled on the VM. |
Beta Was this translation helpful? Give feedback.
-
I found I can use the
|
Beta Was this translation helpful? Give feedback.
I found I can use the
ipv4_addresses
attribute on theproxmox_virtual_environment_vm
resource. It produces a list of lists which is a little awkward, so I flatten() it, and then use setsubtract() to remove localhost: