From bf5bf9b3dc70114a7215f1466c77cc727fc86d37 Mon Sep 17 00:00:00 2001 From: tobias-richter Date: Wed, 22 Aug 2018 13:41:16 +0200 Subject: [PATCH] Add support for -noproxy curl argument (#10) --- README.md | 4 ++++ defaults/main.yml | 2 ++ tasks/curl.yml | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c71e7c8..ae269f9 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,10 @@ Default expected http code when redirects are followed. Allow or disallow insecure certificates. + conga_aemdst_curl_noproxy: false + +When set to true the curl command is executed with `--noproxy "*"`. + conga_aemdst_curl_connect_timeout: 10 Maximum time allowed for the connection to the dispatcher in seconds. diff --git a/defaults/main.yml b/defaults/main.yml index df30ed6..412bafc 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -29,6 +29,8 @@ conga_aemdst_curl_follow_redirects: false conga_aemdst_curl_follow_redirects_expected_http_code: 200 # Allow or disallow insecure certificates. conga_aemdst_curl_allow_insecure: false +# Controls the --noproxy curl argument +conga_aemdst_curl_noproxy: false # Maximum time allowed for the connection to the dispatcher in seconds conga_aemdst_curl_connect_timeout: 10 # Maximum time allowed for the dispatcher smoke test operation in seconds diff --git a/tasks/curl.yml b/tasks/curl.yml index c8934ca..8a194be 100644 --- a/tasks/curl.yml +++ b/tasks/curl.yml @@ -13,6 +13,7 @@ _write_out_arg: "%{redirect_url}\n%{http_code}" _location_arg: "" _insecure_arg: "" + _noproxy_arg: "" _expected_http_code: "{{ conga_aemdst_curl_expected_http_code }}" - name: "Set follow redirect facts" @@ -22,11 +23,16 @@ _expected_http_code: "{{ conga_aemdst_curl_follow_redirects_expected_http_code }}" when: conga_aemdst_curl_follow_redirects -- name: "Set allow insecure" +- name: "Add '--insecure'" set_fact: _insecure_arg: "--insecure" when: conga_aemdst_curl_allow_insecure +- name: "Add '--noproxy'" + set_fact: + _noproxy_arg: '--noproxy "*"' + when: conga_aemdst_curl_noproxy + - debug: msg: - "check redirect from: {{ conga_aemdst_curl_url }}" @@ -38,6 +44,7 @@ shell: 'curl \ {{ _insecure_arg }} \ {{ _location_arg }} \ + {{ _noproxy_arg }} \ --max-time {{ conga_aemdst_curl_timeout }} \ --connect-timeout {{ conga_aemdst_curl_connect_timeout }} \ --write-out "{{ _write_out_arg }}" \