- Ansible Runner Python Examples
- Ansible Runner Python Example Interview
- Ansible Runner Python Example Code
The following are 13 code examples for showing how to use ansible.executor.playbookexecutor.PlaybookExecutor.These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. This API is intended for internal Ansible use. Ansible may make changes to this API at any time that could break backward compatibility with older versions of the API. Because of this, external use is not supported by Ansible. If you want to use Python API only for executing playbooks or modules, consider ansible-runner first.
Note
This module is part of ansible-core
and included in all Ansibleinstallations. In most cases, you can use the short module namescript even without specifying the collections:
keyword.However, we recommend you use the FQCN for easy linking to the moduledocumentation and to avoid conflicting with other collections that may havethe same module name.
The
script
module takes the script name followed by a list of space-delimited arguments.Either a free form command or
cmd
parameter is required, see the examples.The local script at path will be transferred to the remote node and then executed.
The given script will be processed through the shell environment on the remote node.
This module does not require python on the remote system, much like the ansible.builtin.raw module.
This module is also supported for Windows targets.
Note
This module has a corresponding action plugin.
Ansible Runner Python Examples
Parameter | Choices/Defaults | Comments |
---|---|---|
chdir string | Change into this directory on the remote node before running the script. | |
cmd string | Path to the local script to run followed by optional arguments. | |
creates string | A filename on the remote node, when it already exists, this step will not be run. | |
decrypt boolean |
| This option controls the autodecryption of source files using vault. |
executable string | Name or path of a executable to invoke the script with. | |
free_form string | Path to the local script file followed by optional arguments. | |
removes string | A filename on the remote node, when it does not exist, this step will not be run. |
Note
It is usually preferable to write Ansible modules rather 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.If the path to the local script contains spaces, it needs to be quoted.
This module is also supported for Windows targets.
Does not support
check_mode
.
See also
The official documentation on the ansible.builtin.shell module.
The official documentation on the ansible.windows.win_shell module.
Ansible Runner Python Example Interview
Authors
Ansible Runner Python Example Code
Ansible Core Team
Michael DeHaan