summaryrefslogtreecommitdiff
path: root/get_first_open_port.py/usage
diff options
context:
space:
mode:
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