To derive the ip addresses for all nodes in our stack and correctly populate that data into hiera.
Imported some modules in fabfile.py (pycurl,json,cStringIO,re,yaml)
Created three functions
1.getToken
The above function accepts username,password,tenantname and keystone auth url as parameter.
Generates a curl request and depending on response code it returns back the data.
In http response code is 200 then it returns back the response which it gets from keystone
other than that it returns NULL
2.geVmList
This function accepts two parameter (token and nova url)
Generates a curl request and depending on response code it returns back the data.
In http response code is 200 then it returns back the response which it gets from nova
other than that it returns NULL
3.createResourceYaml
This function calls the function gettoken and parse the responce and save token in a
variable,then it calls the getvmlist function to get the list of all
vms in that tenant,then it splits the name of vm to get the vm name and project name
Then it checks the ip of all vm which belongs to that project and add ip adderess to respective array
Then it generates a yaml file in /tmp