Interview Prep/Ansible/Variables, Facts and Precedence Problems

A Jenkins job hangs forever at the start of `ansible-playbook`

BeginnerTroubleshootingVariables, Facts and Precedence Problems
Answer

Likely causes → The play uses vars_prompt, or the run passes --ask-become-pass or --ask-vault-pass, and there is no terminal to answer the prompt.

Diagnose → Run the same command locally and see whether it prompts. grep -rn vars_prompt playbooks/.

Fix → Supply the values without prompting. A vars_prompt variable is skipped if it is passed with -e. Use --vault-password-file or a script, and put the become password in a vaulted ansible_become_password.

Prevent → Make playbooks non-interactive by default, and add a CI timeout so a hang fails quickly.

All Ansible questions Roadmap: Ansible

More on Variables, Facts and Precedence Problems