#!/bin/bash
dockerNodes=".virtual_machines.txt"

while read data
do
    vmName=$(echo "$data" | cut -d ";" -f 1)
    vmId=$(echo "$data" | cut -d ";" -f 2)
    vmRam=$(echo "$data" | cut -d ";" -f 3)
    vmIp=$(echo "$data" | cut -d ";" -f 5)
    vmMac=$(echo "$data" | cut -d ";" -f 6)
    proxmoxNode=$(echo "$data" | cut -d ";" -f 4)
    aUser=$(echo "$data" | cut -d ";" -f 7)
    aPasswd=$(echo "$data" | cut -d ";" -f 8)

    export "ansible_${vmName}_vmName=$vmName"
    export "ansible_${vmName}_vmId=$vmId"
    export "ansible_${vmName}_vmRam=$vmRam"
    export "ansible_${vmName}_vmIp=$vmIp"
    export "ansible_${vmName}_vmMac=$vmMac"
    export "ansible_${vmName}_proxmoxNode=$proxmoxNode"
    export "ansible_${vmName}_user=$aUser"
    export "ansible_${vmName}_passwd=$aPasswd"

done < $dockerNodes

#env | grep -i "ansible" | sort -u
