Interview Prep/Ansible/Modules, Idempotency and Handlers

`get_url` fails with `Request failed: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate>`

IntermediateTroubleshootingModules, Idempotency and Handlers
Answer

Likely causes → A corporate TLS-intercepting proxy or an internal CA (Artifactory, Nexus) whose root certificate is not in the target host's trust store. It can also be an old CA bundle on an old OS.

Diagnose →

curl -v https://artifactory.internal/app.tgz
openssl s_client -connect artifactory.internal:443 -showcerts &lt;/dev/null

Fix → Install the CA on the hosts:

- ansible.builtin.copy:
    src: corp-root-ca.crt
    dest: /usr/local/share/ca-certificates/corp-root-ca.crt
  notify: update ca trust       # update-ca-certificates / update-ca-trust

Use ca_path: on get_url and uri for one-off cases. Use validate_certs: false only in a lab, never in production.

Prevent → Make CA trust part of the base role that runs first on every host.

All Ansible questions Roadmap: Ansible

More on Modules, Idempotency and Handlers