Interview Prep/Ansible/Privilege Escalation and Python Interpreter Issues

`E: Unable to locate package nginx` on a fresh Ubuntu host

BeginnerTroubleshootingPrivilege Escalation and Python Interpreter Issues
Answer

Likely causes → The apt cache has never been updated.

Diagnose → apt-cache policy nginx.

Fix →

- ansible.builtin.apt:
    name: nginx
    update_cache: true
    cache_valid_time: 3600

Prevent → Always use update_cache with cache_valid_time in bootstrap roles.

All Ansible questions Roadmap: Ansible

More on Privilege Escalation and Python Interpreter Issues