I have a Django project that loads most of it’s environment specific configuration from environment variables.
Ansible provides you a way to set the environment, variable by variable, but it appears to be on a per task basis. In my project I load over 10 environment variables, for keys, hostnames, and other reasons.
If I want to run multiple commands does this mean that I have to repeatedly set the environment?
Is there a better facility to do this or a way to load the environment varaibles of a user in Ansible?
Thanks,
–Adam
You do have to set it on a per task basis, at least presently.
The best way to do this is to assign it to a task variable, on each task, just
- some_module: some_args=1234
environment: my_env
I’m open to including environment as a playbook value also, it’s just something that’s not there presently. If it were, it would need to have the task ones merged in each time so the play variables get overriden if any of the same ones are set.
Pull requests would be entertained and welcome (and awesome), otherwise open a feature request on github?