All I did was add some
proxy variables to my host_vars for each host or group, for example:
# proxy settings
proxy: true
proxy_host: 172.16.228.1
proxy_port: 3128
And I'd reference those in my proxy configs like this:
http://{{ proxy_host }}:{{ proxy_port }}
In my proxy role, I have added tasks with 'when: proxy' to only run only
when proxy is set to true.
- name: "Copy /etc/apt/apt.conf.d/00proxy for apt proxy configuration"
template: src=00proxy.j2 dest=/etc/apt/apt.conf.d/00proxy owner=root
group=root mode=644
when: ansible_distribution == 'Ubuntu' and proxy
If I don't want to use the proxy role I just add 'proxy: false' to my
host_vars for that server.
I'd like an easier way to just exclude the proxy role from hosts that
are set to false instead of adding when: proxy to each action.
10 November 2014
at 4:28 PM