Ansible SSL certificate failed- urlopen error
I try to run ansible-playbook from OSX that run this task and I'm getting the error bellow I tried to run 'Install Certificates.command' from Python folder but it didn't solve my problem.
fatal: [XXX]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "elapsed": 0, "msg": "Status code was -1 and not [200]: Request failed: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897)>", "redirected": false, "status": -1, "url": "https://XXX.XXX.com/rest/api/2/cluster/zdu/state"}
tasks:
- name: get Cluster state
uri:
url: https://{{ base_url }}.xxx.com/rest/api/2/cluster/zdu/state
headers:
Content-Type: application/json
force_basic_auth: true
please assist.
As show in the official documentation page of URI module, you have to use the validate_certs: no
parameter in order to disable SSL check.
In addition, your task says force_basic_auth: true
which means you want to give authentication credentials throught HTTP Header, thing you don't actually do ;)