An Ansible playbook fails intermittently when deploying web servers. The error message indicates that a required package is not available in the repository. Which approach would best ensure that the required packages are consistently available before the playbook runs?
Trap 1: Set 'ignore_errors: yes' on the package installation task and…
Ignoring errors can lead to an inconsistent system state.
Trap 2: Add retries and delay to the package installation task.
Retries only help with transient failures, not with permanently missing packages.
Trap 3: Use the 'get_url' module to download the package from an external…
While possible, it adds complexity and may not be a best practice.
- A
Set 'ignore_errors: yes' on the package installation task and handle the failure later.
Why wrong: Ignoring errors can lead to an inconsistent system state.
- B
Add retries and delay to the package installation task.
Why wrong: Retries only help with transient failures, not with permanently missing packages.
- C
Add a pre_task to run 'dnf update' or 'apt update' before the package installation.
Updating the repository cache ensures the latest package metadata is available.
- D
Use the 'get_url' module to download the package from an external source and install it manually.
Why wrong: While possible, it adds complexity and may not be a best practice.