Typically, the shell, command, or script modules are used to invoke a command on a managed node (e.g. target systems). /usr/bin/python needs to exist on the managed node to use these modules. If Python does not exist, the raw module can be used instead.
The ansible-doc script command can be used to show the Ansible documention on the script module.
In this example, script.sh must reside on your control node (that's your Ansible server).
- name: my script
script: /path/to/your/script.sh
The playbook can then be executed using this command.
ansible-playbook playbook.yml
The following should be produced.
TASK [my script]
changed: [server1.example.com]
By default, no stdout is printed. The debug module can be used to print output to the console.
By default, Ansible performs tasks on managed node. The connection module or delegate_to module can be used to invoke the script module on the control node (that's the Ansible server).