Interview Prep/Ansible/Vault, Performance and Execution Behaviour

Packages got installed on the CI runner, and every "host" in the output reports the runner's hostname

IntermediateTroubleshootingVault, Performance and Execution Behaviour
Answer

Likely causes → connection: local (play level) or ansible_connection: local (in group_vars/all) was copied from an API-only playbook. Every task now runs on the controller once per inventory host.

Diagnose →

ansible-inventory --host web01 --vars | grep ansible_connection
grep -rn 'connection: local' playbooks/

Fix → Remove the setting, and for API tasks use delegate_to: localhost (or hosts: localhost) only where it is needed. Then clean up the runner.

Prevent → Run CI on ephemeral runners, and add an assert that ansible_facts['hostname'] matches the expected pattern in sensitive roles.

All Ansible questions Roadmap: Ansible

More on Vault, Performance and Execution Behaviour