Skip to content

Commit 97910e2

Browse files
committed
revert proxy_tasks_only but make configuring proxy easier
1 parent 4a48c2f commit 97910e2

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

ansible/roles/proxy/README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ Define http/s proxy configuration.
44

55
## Role variables
66

7-
- `proxy_http_proxy`: Required. Address of http proxy. E.g. "http://10.1.0.28:3128" for a Squid proxy on default port.
8-
- `proxy_https_proxy`: Optional. Address of https proxy. Default is `{{ proxy_http_proxy }}`.
9-
- `proxy_no_proxy_extra`: Optional. List of additional addresses not to proxy. Will be combined with default list which includes `inventory_hostname` (for hostnames) and `ansible_host` (for host IPs) for all Ansible hosts.
10-
- `proxy_plays_only`: Optional bool. Whether to configure proxying only for Ansible plays (via the [environment](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_environment.html) keyword). Default `false` which means proxy configuration is written to the host and available to all users. If `true` this role must be run in the playbook for proxying to be available as it sets host facts.
11-
- `proxy_dnf`: Optional bool. Whether to configure yum/dnf proxying through `proxy_http_proxy`. Default `true` unless `proxy_plays_only` is `true`.
12-
- `proxy_systemd`: Optional bool. Whether to give processes started by systemd the above http, https and no_proxy configuration. **NB** Running services will need restarting if this is changed. Default `true` unless `proxy_plays_only` is `true`.
7+
- `proxy_http_proxy`: Required str. Address of http proxy, e.g. `'http://squid.mysite.org:3128`'.
8+
**NB:** If the `squid` group is enabled, this defaults to the address of the
9+
first host in that group and the configured port. See `environments/common/inventory/group_vars/all/proxy.yml`
10+
for other convenience variables to configure this.
11+
- `proxy_https_proxy`: Optional string. Address of https proxy. Default is `{{ proxy_http_proxy }}`.
12+
- `proxy_no_proxy_extra`: Optional list. Additional addresses not to proxy. Will
13+
be combined with default list which includes `inventory_hostname` (for hostnames)
14+
and `ansible_host` (for host IPs) for all Ansible hosts.
15+
- `proxy_dnf`: Optional bool. Whether to configure yum/dnf proxying through `proxy_http_proxy`.
16+
Default `true`.
17+
- `proxy_systemd`: Optional bool. Whether to give processes started by systemd
18+
the above http, https and no_proxy configuration. **NB** Running services will
19+
need restarting if this is changed. Default `true`.

ansible/roles/proxy/defaults/main.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ proxy_https_proxy: "{{ proxy_http_proxy }}"
33
proxy_no_proxy_defaults: "{{ ['localhost', '127.0.0.1'] + groups['all'] + hostvars.values() | map(attribute='ansible_host') }}"
44
proxy_no_proxy_extras: []
55
proxy_no_proxy: "{{ (proxy_no_proxy_defaults + proxy_no_proxy_extras) | unique | sort | join(',') }}"
6-
proxy_plays_only: false
7-
proxy_dnf: "{{ not proxy_plays_only }}"
8-
proxy_systemd: "{{ not proxy_plays_only }}"
6+
proxy_dnf: true
7+
proxy_systemd: true

ansible/roles/proxy/tasks/main.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
state: present
1010
regexp: "{{ item.key }}=.*"
1111
line: "{{ item.key }}={{ item.value }}"
12-
when: not proxy_plays_only | bool
1312
loop:
1413
- key: http_proxy
1514
value: "{{ proxy_http_proxy }}"
@@ -64,13 +63,3 @@
6463
- name: Reset connection to get new /etc/environment
6564
meta: reset_connection
6665
# NB: conditionals not supported
67-
68-
- name: Add proxy vars to appliances_environment_vars
69-
set_fact:
70-
appliances_environment_vars: "{{ appliances_environment_vars | combine(_proxy_vars) }}"
71-
vars:
72-
_proxy_vars:
73-
http_proxy: "{{ proxy_http_proxy }}"
74-
https_proxy: "{{ proxy_https_proxy }}"
75-
no_proxy: "{{ proxy_no_proxy }}"
76-
when: proxy_plays_only | bool

0 commit comments

Comments
 (0)