summaryrefslogtreecommitdiff
path: root/get_first_open_port.py/usage
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2018-10-02 14:33:43 -0400
committerB Stack <bgstack15@gmail.com>2018-10-02 14:33:43 -0400
commit389c4fd4a91d8e7a7986702ef9c21ce602da1868 (patch)
tree9e260278972e85600e981bb52d931bd6df046acd /get_first_open_port.py/usage
parentadd ansible_callback_plugin short (diff)
downloadformer-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/usage23
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) }}"
bgstack15