Skip to content

Commit

Permalink
Add support for -noproxy curl argument (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-richter authored Aug 22, 2018
1 parent b35c605 commit bf5bf9b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion tasks/curl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 }}"
Expand All @@ -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 }}" \
Expand Down

0 comments on commit bf5bf9b

Please sign in to comment.