Interview Prep/Ansible/Privilege Escalation and Python Interpreter Issues

`The conditional check 'ansible_distribution == "Ubuntu"' failed. The error was: error while evaluating conditional: 'ansible_distribution' is undefined`

IntermediateTroubleshootingPrivilege Escalation and Python Interpreter Issues
Answer

Likely causes → gather_facts: false, facts failed to gather, or injected facts disabled (inject_facts_as_vars = False).

Diagnose → ansible web01 -m setup -a 'filter=ansible_distribution'.

Fix → Enable fact gathering or run setup; use ansible_facts['distribution'].

Prevent → Always use the ansible_facts[...] form.

All Ansible questions Roadmap: Ansible

More on Privilege Escalation and Python Interpreter Issues