diff options
author | B Stack <bgstack15@gmail.com> | 2018-10-02 14:33:43 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2018-10-02 14:33:43 -0400 |
commit | 389c4fd4a91d8e7a7986702ef9c21ce602da1868 (patch) | |
tree | 9e260278972e85600e981bb52d931bd6df046acd /get_first_open_port.py/usage | |
parent | add ansible_callback_plugin short (diff) | |
download | former-gists-389c4fd4a91d8e7a7986702ef9c21ce602da1868.tar.gz former-gists-389c4fd4a91d8e7a7986702ef9c21ce602da1868.tar.bz2 former-gists-389c4fd4a91d8e7a7986702ef9c21ce602da1868.zip |
add get_first_open_port.py
Diffstat (limited to 'get_first_open_port.py/usage')
-rw-r--r-- | get_first_open_port.py/usage | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/get_first_open_port.py/usage b/get_first_open_port.py/usage new file mode 100644 index 0000000..61b537c --- /dev/null +++ b/get_first_open_port.py/usage @@ -0,0 +1,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) }}" |