Interview Prep/Ansible/Modules, Idempotency and Handlers

`unarchive` fails with `Failed to find handler for "/tmp/app.tar.gz". Make sure the required command to extract the file is installed.`

IntermediateTroubleshootingModules, Idempotency and Handlers
Answer

Likely causes → The target is missing the tool needed to extract the archive (unzip for .zip, tar and gtar, zstd, xz), or the file is not a valid archive at all (an HTML error page saved as .tar.gz).

Diagnose → file /tmp/app.tar.gz and which unzip tar on the target.

Fix → Install the extractor first (package: name=unzip). Download with get_url and a checksum:, so a bad download fails before unarchive. Remember that remote_src: true is needed when the archive is already on the target.

Prevent → List archive tools in the base role, and always verify checksums of downloaded artifacts.

All Ansible questions Roadmap: Ansible

More on Modules, Idempotency and Handlers