Add test that url lookup checks tls certificates
This commit is contained in:
parent
30c1a2d861
commit
605ddad37e
1 changed files with 31 additions and 0 deletions
|
@ -163,3 +163,34 @@
|
||||||
- name: set with_dict
|
- name: set with_dict
|
||||||
shell: echo "{{ item.key + '=' + item.value }}"
|
shell: echo "{{ item.key + '=' + item.value }}"
|
||||||
with_dict: "{{ mydict }}"
|
with_dict: "{{ mydict }}"
|
||||||
|
|
||||||
|
# URL Lookups
|
||||||
|
|
||||||
|
- name: Test that retrieving a url works
|
||||||
|
set_fact:
|
||||||
|
web_data: "{{ lookup('url', 'https://gist.githubusercontent.com/abadger/9858c22712f62a8effff/raw/43dd47ea691c90a5fa7827892c70241913351963/test') }}"
|
||||||
|
|
||||||
|
- name: Assert that the url was retrieved
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "'one' in web_data"
|
||||||
|
|
||||||
|
- name: Test that retrieving a url with invalid cert fails
|
||||||
|
set_fact:
|
||||||
|
web_data: "{{ lookup('url', 'https://kennethreitz.org/') }}"
|
||||||
|
ignore_errors: True
|
||||||
|
register: url_invalid_cert
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "url_invalid_cert.failed"
|
||||||
|
- "'Error validating the server' in url_invalid_cert.msg"
|
||||||
|
|
||||||
|
- name: Test that retrieving a url with invalid cert with validate_certs=False works
|
||||||
|
set_fact:
|
||||||
|
web_data: "{{ lookup('url', 'https://kennethreitz.org/', validate_certs=False) }}"
|
||||||
|
register: url_no_validate_cert
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "'kennethreitz.org' in web_data"
|
||||||
|
|
Loading…
Reference in a new issue