Make fetch_url check the server's certificate on https connections

This commit is contained in:
Toshio Kuratomi 2015-05-28 12:35:37 -07:00
commit afc19894e1
2 changed files with 52 additions and 17 deletions

View file

@ -25,3 +25,23 @@
that:
- result.changed
- '"OK" in result.msg'
- name: test https fetch to a site with invalid domain
get_url:
url: "https://kennethreitz.org/"
dest: "{{ output_dir }}/shouldnotexist.html"
ignore_errors: True
register: result
- stat:
path: "{{ output_dir }}/shouldnotexist.html"
register: stat_result
- debug: var=result
- name: Assert that the file was not downloaded
assert:
that:
- "result.failed == true"
- "'Certificate does not belong to ' in result.msg"
- "stat_result.stat.exists == false"