Kolla creates an admin.rc file using the environment variables. I want to then use this in a terraform plan, but I’d rather not generate terrafoprm specific code for the Keystone login data. So, a simple python script converts from env vars to yaml.
#!/usr/bin/python3 import os import yaml clouds = { "clouds":{ "cluster": { "auth" : { "auth_url" : os.environ["OS_AUTH_URL"], "project_name": os.environ["OS_PROJECT_NAME"], "project_domain_name": os.environ["OS_PROJECT_DOMAIN_NAME"], "username": os.environ["OS_USERNAME"], "user_domain_name": os.environ["OS_USER_DOMAIN_NAME"], "password": os.environ["OS_PASSWORD"] } } } } print (yaml.dump(clouds)) |
To use it:
./clouds.py > clouds.yaml |
Note that you should have sourced the appropriate config environment variables file, such as :
. /etc/kolla/admin-openrc.sh |