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:
"
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.