While trying to resolve a seemingly arbitrary failure in the k5_auth module, I narrowed down the failure after realising it would always happen after building some K5 infrastructure with a HEAT stack.
This turned out to be my usage of a set-k5env.sh script, which populates a shell environment with the same variables that an openrc file would generate, except it also produces an $OS_AUTH_TOKEN so I can use curl to talk directly to an OpenStack API (this is a tangential issue which involved newly created virtual networks / virtual routers not properly connecting to external network interface).
The presence of any value assigned to $OS_AUTH_TOKEN causes the k5_auth module to fail with example output:
Traceback (most recent call last):
File \"/tmp/ansible_UvQlFT/ansible_module_k5_auth.py\", line 466, in <module>
main()
File \"/tmp/ansible_UvQlFT/ansible_module_k5_auth.py\", line 461, in main
k5_get_auth_token(module)
File \"/tmp/ansible_UvQlFT/ansible_module_k5_auth.py\", line 353, in k5_get_auth_token
k5_get_auth_spec(module)
File \"/tmp/ansible_UvQlFT/ansible_module_k5_auth.py\", line 307, in k5_get_auth_spec
elif OS_USERNAME is None:
UnboundLocalError: local variable 'OS_USERNAME' referenced before assignment
A quick workaround is to unset OS_AUTH_TOKEN before running a playbook.
My time to directly troubleshoot this is constrained due to current project timescales, but I will happily try and take a look at this when I get the chance, not least because it'll force me to figure out exactly how your modules work :)
not happy about this, but os_client_config.OpenStackConfig().get_allclouds() seems to wipe the OS envvars if OS_AUTH_TOKEN is set.
This is outside this projects scope, so this k5 module will unset OS_AUTH_TOKEN
While trying to resolve a seemingly arbitrary failure in the k5_auth module, I narrowed down the failure after realising it would always happen after building some K5 infrastructure with a HEAT stack.
This turned out to be my usage of a set-k5env.sh script, which populates a shell environment with the same variables that an openrc file would generate, except it also produces an $OS_AUTH_TOKEN so I can use curl to talk directly to an OpenStack API (this is a tangential issue which involved newly created virtual networks / virtual routers not properly connecting to external network interface).
The presence of any value assigned to $OS_AUTH_TOKEN causes the k5_auth module to fail with example output:
A quick workaround is to
unset OS_AUTH_TOKEN
before running a playbook.My time to directly troubleshoot this is constrained due to current project timescales, but I will happily try and take a look at this when I get the chance, not least because it'll force me to figure out exactly how your modules work :)