Ansible - script module (invoking a script)

If you are not familiar with modules, check out Ansible - Getting Started with Modules.

Typically, the shellcommand, 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. 

In this example, must reside on your control node (that's your Ansible server).

- name: my script
  script: /path/to/your/


The playbook can then be executed using this command.

ansible-playbook playbook.yml


The following should be produced.

TASK [my script]
changed: []


By default, no stdout is printed. The debug module can be used to print output to the console.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter aa03e in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |