Add test that url lookup checks tls certificates

This commit is contained in:
Toshio Kuratomi 2015-06-15 16:41:57 -07:00
parent 30c1a2d861
commit 605ddad37e

View file

@ -163,3 +163,34 @@
- name: set with_dict
shell: echo "{{ item.key + '=' + item.value }}"
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"