blob: 61b537c623ac7693e7d814204da25106c323a1d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
vars:
http_proxies:
- 192.168.1.5:3128
- proxy5.internal.example.com:3128
tasks:
- name: learn which proxy to use
script: get_first_open_port.py {{ http_proxies | join( " " ) }}
changed_when: false
register: open_ports
- set_fact:
http_proxy: "{{ open_ports.stdout_lines[0] }}"
when:
- 'open_ports.stdout | length > 0'
failed_when:
- 'open_ports.stdout | length = 0'
- name: use http_proxy environment variable
script: script_needing_internet.sh -i {{ inputvar }}
environment:
http_proxy: "{{ http_proxy | default(omit) }}"
|