Django Project with Many Environment Variables

98 views
Skip to first unread message

Adam Duren

unread,
May 9, 2014, 6:10:16 PM5/9/14
to ansible...@googlegroups.com
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

Michael DeHaan

unread,
May 9, 2014, 7:42:59 PM5/9/14
to ansible...@googlegroups.com
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?




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9785a2cf-ca73-475f-9d49-79707110a8ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages