I have a list, an excerpt of which looks like this:
variable “virtual_machines” {
default = {
“master1” = {
name = “z-ca-bdc-master1”
worker_node = false
ipv4_address = “192.168.113.79”
ipv4_netmask = “22”
ipv4_gateway = “192.168.112.1”
dns_server = “192.168.112.2”
ram = 8192
logical_cpu = 4
disk0_size = 40
disk1_size = 0
},
“master2” = {
name = “z-ca-bdc-master2”
worker_node = false
ipv4_address = “192.168.113.80”
ipv4_netmask = “22”
ipv4_gateway = “192.168.112.1”
dns_server = “192.168.112.2”
ram = 8192
logical_cpu = 4
disk0_size = 40
disk1_size = 0
},
This is associated with other config files that I use to create Ubuntu virtual machine on VMware vSphere, this works fine, I then want to create a Kubernetes cluster via Kubespray, which is basically a set of ansible playbooks. My challenge is converting my list to something which looks like this ( this is the sample inventory.ini file), I could probably run my .tf file through something like awk to get an inventory file that ansible likes, however - presuming that I’m not the first person to ever have done this, I’m wondering if there is a more elegant and simpler way to achieve this.