A teammate puts `ansible_python_interpreter` in every play. Where should it live?
BeginnerScenarioVariables, Facts and Templates
Answer
Situation read → Connection config duplicated.
What I'd do → Move it to inventory (group_vars/all.yml or host vars), or set interpreter_python = auto_silent in ansible.cfg.
# group_vars/legacy.yml
ansible_python_interpreter: /usr/bin/python3.9
Why → It is a property of the host, not the play.
Interview tip → Modern Ansible discovers Python automatically (auto).
More on Variables, Facts and Templates
A variable you set in `group_vars` is being overridden and you do not know where. How do you find the source?IntermediateYou need different values per environment without copying playbooks.BeginnerYou must render an Nginx config with one `server` block per site from a list.IntermediateA template needs the IPs of all hosts in the `db` group, for example for a replication config.IntermediateNothing should be rendered unless a mandatory variable is supplied.BeginnerPer-host values, like `server_id` for MySQL, must be unique and stable.Intermediate