This can be applied to install package from apt repo.
I have three ubuntu servers under the group linux.
YAML file
--- - hosts: linux become: true become_user: root tasks: - name: apt update && apt install tree -y apt: update_cache: yes name: tree state: present ...
Reference: https://docs.ansible.com/ansible/latest/modules/apt_module.html
Execution
Result
The ansible python script is sent from the control node to the ubuntu servers, this is the default behaviour, unless the connection is like network_cli then the control node executes ssh to the network device which does not have python to execute the playbook.