Ansible Playbook & Module Errors
The Ansible failures that stop a playbook mid-run: a module or action that won't resolve, an undefined variable, an SSH host-key or connection failure, a privilege-escalation (become) problem, an apt/dpkg lock, a Vault decryption error, or a Jinja2 template error. Each guide opens with the cause and the exact task/inventory/CLI fix. Pick your error below, or paste the `-vvv` output into the assistant.
Fix your error now
Paste the error or logs and let the Incident Assistant diagnose it, or run a guided triage prompt with AI — no copy-paste.
Every guide in this cluster
49 guides-
'Could not get lock /var/lib/dpkg/lock' apt Module Failure
Fix Ansible's apt 'Failed to lock apt for exclusive operation / Could not get lock /var/lib/dpkg/lock-frontend' error: diagnose concurrent apt, unattended-upgrades, and stale locks.
-
'couldn't resolve module/action' in Ansible — Causes & Fix
Fix Ansible's 'couldn't resolve module/action': usually a missing Galaxy collection or wrong FQCN. Diagnose collections, path, and typos to run your playbook.
-
'AnsibleUndefinedVariable' Exception During Task Execution
Fix Ansible's 'An exception occurred during task execution ... AnsibleUndefinedVariable' error: diagnose missing vars, scoping, typos, and unset facts in playbooks.
-
'Host key verification failed' SSH Connection Failure
Fix Ansible's 'Failed to connect to the host via ssh: Host key verification failed' error: diagnose stale known_hosts entries, re-imaged hosts, and host key checking.
-
'Destination directory does not exist' in Ansible — Fix
Fix Ansible's copy/template 'Destination directory does not exist' error: usually a missing parent path or wrong dest. Diagnose and fix with real steps.
-
'[Errno 2] No such file or directory' — Fix command Module Failures
Fix the command module's '[Errno 2] No such file or directory' error using absolute binary paths, avoiding shell syntax, and setting creates and chdir.
-
'A worker was found in a dead state' — Fix OOM-Killed Forks
Fix Ansible's 'A worker was found in a dead state' error: usually the OOM killer terminating fork workers. Reduce forks, cut fact and variable memory, and give the controller more RAM.
-
'certificate verify failed' ansible-galaxy x509 TLS Error
Fix ansible-galaxy's 'SSL: CERTIFICATE_VERIFY_FAILED' x509 error: diagnose missing CA bundles, proxies, expired certs, and self-signed Galaxy/Automation Hub endpoints.
-
'Decryption failed' — Fix Vault Secret Access
Fix Ansible's 'Decryption failed (no vault secrets were found that could decrypt)' error: supply the right vault password, match vault IDs, and repair corrupted encrypted files.
-
'dict object' has no attribute (Undefined Variable)
Fix Ansible's FAILED! 'dict object' has no attribute error: diagnose undefined variables, typos in var names, missing facts, wrong scope, and unset registered results.
-
'does not support check mode' — Fix Check-Mode Task Failures
Fix Ansible's 'does not support check mode' error using check_mode false, changed_when, and idempotent modules so --check dry-runs report changes honestly.
-
'FAILED - RETRYING' Until Loop Retries Exhausted
Fix Ansible's 'FAILED - RETRYING ... (retries left)' loop that ends in failure: diagnose until/retries conditions, slow services, wrong success checks, and timeouts.
-
'Failed to import the required Python library' (module dependency)
Fix Ansible's Failed to import the required Python library error: install module dependencies into the right interpreter, handle venvs, pip vs system Python, and become.
-
'Failed to parse ... with the inventory plugins' Inventory Error
Fix Ansible's 'Failed to parse /path with the inventory plugins: ini, yaml' error: diagnose bad inventory syntax, wrong file format, missing groups, and plugin selection.
-
'Failed to set permissions on the temporary files' — Fix Unprivileged become
Fix Ansible's 'Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user' by installing ACL support or adjusting become and the temp dir.
-
'Incorrect sudo password' Privilege Escalation Failure
Fix Ansible's 'Incorrect sudo password' become error: diagnose wrong become_pass, missing --ask-become-pass, vaulted secrets, and sudoers configuration on remote hosts.
-
'Missing sudo password' / Incorrect sudo password
Fix Ansible's Missing sudo password and Incorrect sudo password errors: diagnose --ask-become-pass, become_pass vaults, NOPASSWD sudoers, and wrong become_method.
-
'MODULE FAILURE' (module failed to execute / Python interpreter)
Fix Ansible's MODULE FAILURE error: diagnose missing or wrong Python interpreter, ansible_python_interpreter, stray stdout on the host, and modules failing to execute.
-
'No package matching is available' — Fix Package Install Failures
Fix Ansible's 'No package matching X is available' error by correcting package names per distro, refreshing repo metadata, and enabling the right repositories.
-
'Permission denied (publickey,password)' — Fix SSH Auth Failures
Fix Ansible's 'Permission denied (publickey,password)' SSH failure by correcting the remote user, key path, agent, and ansible_user vars so plays authenticate.
-
'provided hosts list is empty' — Fix Empty Inventory Targeting
Fix Ansible's 'provided hosts list is empty, only localhost is available' warning by repairing inventory paths, group patterns, and dynamic inventory output.
-
'recursive loop detected in template string' — Fix Self-Referential Vars
Fix Ansible's 'recursive loop detected in template string' error by breaking self-referential variables, renaming shadowed vars, and restructuring group_vars.
-
'Specified hosts and/or --limit does not match any hosts' — Fix Targeting
Fix Ansible's 'Specified hosts and/or --limit does not match any hosts' error: correct the inventory source, host patterns, group names, and --limit so your play targets the hosts you expect.
-
'Syntax Error while loading YAML' — Fix Bad YAML
Fix Ansible's 'Syntax Error while loading YAML: mapping values are not allowed in this context' error: unquoted colons, bad indentation, tabs, and unbalanced Jinja braces.
-
'target uses selinux but python bindings aren't installed' — Fix
Fix Ansible's 'Aborting, target uses selinux but python bindings (libselinux-python) aren't installed' error: install libselinux for the right interpreter and match SELinux state.
-
'template error while templating string' Jinja2 Failure
Fix Ansible's 'template error while templating string' Jinja2 error: diagnose syntax mistakes, undefined filters, type errors, and bad expressions inside templates and vars.
-
'The conditional check ... failed'
Fix Ansible's The conditional check failed error: diagnose undefined vars in when, wrong types, quoting of Jinja, string-vs-bool comparisons, and bad registered results.
-
'the role ... was not found'
Fix Ansible's ERROR! the role was not found error: diagnose roles_path, missing galaxy roles, requirements.yml, collection roles, and wrong role names or directory layout.
-
'Timeout (12s) waiting for privilege escalation prompt'
Fix Ansible's Timeout waiting for privilege escalation prompt error: diagnose wrong become_pass, sudo prompts, requiretty, slow PAM/LDAP, and stuck su/sudo escalation.
-
'unable to convert to int' — Fix Argument Type Mismatches
Fix Ansible's 'we were unable to convert to int' argument error by casting templated strings, defaulting empty vars, and matching module argument types.
-
'UNREACHABLE!' Failed to connect to the host via ssh
Fix Ansible's UNREACHABLE! Failed to connect to the host via ssh error: diagnose SSH auth, host key prompts, wrong user/port, DNS, and unreachable inventory hosts.
-
'Unsupported parameters for module' — Fix Invalid Task Arguments
Fix Ansible's 'Unsupported parameters for module' error by correcting misspelled arguments, matching the collection version, and validating with ansible-doc.
-
'value of state must be one of' — Fix Invalid Module Argument Choices
Fix Ansible's 'value of state must be one of' error by supplying a valid choice, fixing templated values, quoting booleans, and checking module documentation.
-
'... is not a valid attribute for a Task' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'X is not a valid attribute for a Task/Play' error: misindented module args, misspelled keywords, or module params placed at the task level.
-
'Attempting to decrypt but no vault secrets found' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'Attempting to decrypt but no vault secrets found' error: supply --ask-vault-pass, a vault_password_file, or the right --vault-id.
-
'Could not find or access ... on the Ansible Controller' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'Could not find or access <file> on the Ansible Controller' error: wrong path, role search order, or a missing copy/template source.
-
'Failed to find required executable git in paths' — Cause, Fix, and Troubleshooting Guide
Fix Ansible git module 'Failed to find required executable git in paths' error: install git on the target or fix PATH for the become user.
-
'Failed to update apt cache' — Cause, Fix, and Troubleshooting Guide
Fix Ansible apt 'Failed to update apt cache' error: unreachable mirrors, expired GPG keys, bad sources.list entries, DNS, or proxy problems on the target host.
-
'Failed to validate the SSL certificate' — Cause, Fix, and Troubleshooting Guide
Fix Ansible get_url/uri 'Failed to validate the SSL certificate' error: install the CA bundle, add the internal CA, fix clock skew, or set ca_path correctly.
-
'found a duplicate dict key' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'found a duplicate dict key' YAML error: remove the repeated mapping key, rename duplicated task keywords, or fix accidental copy-paste in vars.
-
'hosts is required but was not set' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'the field hosts is required but was not set' error: add a hosts key to each play or fix a malformed playbook structure.
-
'Invalid callback for stdout specified' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'Invalid callback for stdout specified' error: enable the plugin, install its collection, or fix stdout_callback config.
-
'None of the provided paths were usable. Please specify a valid path with --roles-path' — Cause, Fix, and Troubleshooting Guide
Fix ansible-galaxy 'None of the provided paths were usable. Please specify a valid path with --roles-path': create/permission or set roles_path.
-
'SSH Error: data could not be sent to remote host' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'SSH Error: data could not be sent to remote host' error: stale control sockets, MTU, idle-timeout firewalls, and overloaded hosts.
-
'The module ... was not found in configured module paths' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'The module <name> was not found in configured module paths' error: missing collection, wrong FQCN, library path, or a typo in the module name.
-
'Timeout when waiting for ...' (wait_for) — Cause, Fix, and Troubleshooting Guide
Fix Ansible wait_for 'Timeout when waiting for <host:port>' error: service not listening, wrong host/port, firewall, or a too-short timeout.
-
'to use the ssh connection type with passwords, you must install the sshpass program' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'to use the ssh connection type with passwords, you must install the sshpass program' error: install sshpass, or switch to key-based auth.
-
'unarchive Failed to find handler ... make sure the required command to extract the file is installed' — Cause, Fix, and Troubleshooting Guide
Fix Ansible unarchive 'Failed to find handler ... make sure the required command to extract the file is installed': install unzip/tar and check the archive.
-
'We were unable to read either as JSON nor YAML' — Cause, Fix, and Troubleshooting Guide
Fix Ansible's 'We were unable to read either as JSON nor YAML' error from --extra-vars: quote inline JSON or pass a valid @vars file.
Ansible AI prompts
Copy-paste, production-safe prompts for this stack.
Ansible command center
Top errors, validators, and runbooks for the whole stack.
Frequently asked questions
Why "couldn't resolve module/action" in my playbook?
ansible-galaxy collection install), a typo in the FQCN, or a collections: keyword that isn't set. See couldn't resolve module/action.How do I fix "Host key verification failed"?
known_hosts, set host_key_checking = False for controlled/ephemeral hosts, or use ssh-keyscan. See host key verification failed.