You are reading an unmaintained version of the Ansible documentation. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See the latest Ansible documentation.
script - Runs a local script on a remote node after transferring it¶
# Example from Ansible Playbooks-script:/some/local/script.sh --some-arguments 1234# Run a script that creates a file, but only if the file is not yet created-script:/some/local/create_file.sh --some-arguments 1234args:creates:/the/created/file.txt# Run a script that removes a file, but only if the file is not yet removed-script:/some/local/remove_file.sh --some-arguments 1234args:removes:/the/removed/file.txt
It is usually preferable to write Ansible modules than pushing scripts. Convert your script to an Ansible module for bonus points!
The ssh connection plugin will force pseudo-tty allocation via -tt when scripts are executed. pseudo-ttys do not have a stderr channel and all stderr is sent to stdout. If you depend on separated stdout and stderr result keys, please switch to a copy+command set of tasks instead of using script.
This module is also supported for Windows targets.
If the path to the local script contains spaces, it needs to be quoted.
This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.
For more information about Red Hat’s this support of this module, please
refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>