`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 </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.
More on Modules, Idempotency and Handlers
`ERROR! The requested handler 'Restart nginx' was not found in either the main handlers list nor in the listening handlers list`BeginnerA handler named `restart {{ app_service }}` is never found when notified as `restart myapp`AdvancedA `command` task reports `changed` on every run, and the Molecule idempotence check failsBeginner`curl ... | tar xz` fails on the host but the `shell` task reports successIntermediate`lineinfile` appends the same line again on every runIntermediate`lineinfile` with `backrefs: true` reports `ok` but the line was never addedIntermediate