" situation: - many systems in different domains (since hosting env) - two domains are internal and only get outside connection via a proxy "
This is EXACTLY why the environment support was written, actually. I was automating an OpenStack config at a very, hmm, structured, company and I had to get to some things on one proxy, some things on another, and sometimes I needed to turn OFF the proxy settings to get things. A certain other config tool couldn't really even do this, so I said, dang it, I've got this, and "enviornment:" in Ansible was born. It sounds like you are trying to specify proxies in inventory, yet, you need to really set them per task. So I would probably define things as "proxy_env_one" and "proxy_env_two" (with better names), and per task, specify which to use. Reading the above though, I'm not sure you're trying to switch between them in the same tasks though, and it may just be that your system isn't in the group you think it is? We'd need to see your inventory. On Fri, Jul 18, 2014 at 2:34 PM, Florian Heigl <[email protected]> wrote: > Hi, > > I have a little problem with conditionally setting a proxy. > > situation: > - many systems in different domains (since hosting env) > - two domains are internal and only get outside connection via a proxy > > So, I need no proxy set for all systems that aren't in those domains. > For those two domains, the proxy should be assigned. > > What I have: > in group_vars/all: > --- > ansible_python_interpreter: /usr/local/bin/python > proxies: > http_proxy: http://no-proxy > > in group_vars/subdomain_domain_de: > --- > proxies: > http_proxy: http://proxy.subdomain_domain_de:8080/ > > > the playbook is and output are here at hastebin: > > http://hastebin.com/doqikusera.md > > > now, the confusing part. > When I run this, I see the node *is* being assigned to the group, but not > getting the proxy from the group_var. > I added one in all, and yes, it gets that one. > > Also, it seems to be a problem if i refer to environment: proxies since > they only apply to 30 of the systems. All the others don't have one > How do I do that without duplicating code? (run one play for proxied, > based on the domain and one for the others? Sounds wrong) > > The docs actually have an example for setting proxies, which is nice, but > it's just too trivial to help with this :( > > any help very appreciated. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/a52963bd-6664-4ceb-b325-bc28b0009ac6%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/a52963bd-6664-4ceb-b325-bc28b0009ac6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwnbWhxTG%2B43ZtaVOJ%3DCJp2hduVV201sGPTj0tdWY3Bsw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
