Ansible - Steps
- Command
- Copy
- File
- Get URL
- Line In File
- Pip
- Apt
- Service
- Shell
- Unarchive
- AShell
- GetBuiltInAnsibleProperties
- Apt Key
Command
Use this step to apply the command module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
taskcommand | textBox | cmd The command to run. |
Yes |
creates | textBox | A filename or (since ansible 2.0) glob pattern. If a matching file already exists, this step will not be run. This is checked before removes is checked. |
No |
environment | textAreaBox | It allows to set environment variables at task level. | No |
chdir | textBox | Change into this directory before running the command. | No |
become | textBox | The become keyword uses existing privilege escalation tools like sudo, su, pfexec, doas, pbrun, dzdo, ksu, runas, machinectl and others. set to true OR yes to activate privilege escalation. | No |
Copy
Use this step to apply the copy module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
src | textBox | Local path to a file to copy to the remote server. This can be absolute or relative. If path is a directory, it is copied recursively. In this case, if path ends with /, only inside contents of that directory are copied to destination. Otherwise, if it does not end with /, the directory itself with all contents is copied. This behavior is similar to the rsync command line tool. |
Yes |
dest | textBox | Remote absolute path where the file should be copied to. If src is a directory, this must be a directory too. If dest is a non-existent path and if either dest ends with / or src is a directory, dest is created. If dest is a relative path, the starting directory is determined by the remote host. If src and dest are files, the parent directory of dest is not created and the task fails if it does not already exist. |
Yes |
owner | textBox | Name of the user that should own the filesystem object, as would be fed to chown. When left unspecified, it uses the current user unless you are root, in which case it can preserve the previous ownership. Specifying a numeric username will be assumed to be a user ID and not a username. Avoid numeric usernames to avoid this confusion. |
No |
group | textBox | Name of the group that should own the filesystem object, as would be fed to chown. When left unspecified, it uses the current group of the current user unless you are root, in which case it can preserve the previous ownership. |
No |
mode | textBox | The permissions of the destination file or directory. For those used to /usr/bin/chmod remember that modes are actually octal numbers. You must either add a leading zero so that Ansible’s YAML parser knows it is an octal number (like 0644 or 01777) or quote it (like ‘644’ or ‘1777’) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, u+rwx or u=rw,g=r,o=r). As of Ansible 2.3, the mode may also be the special string preserve. preserve means that the file will be given the same permissions as the source file. When doing a recursive copy, see also directory_mode. If mode is not specified and the destination file does not exist, the default umask on the system will be used when setting the mode for the newly created file. If mode is not specified and the destination file does exist, the mode of the existing file will be used. Specifying mode is the best way to ensure files are created with the correct permissions. |
No |
with_items | textAreaBox | with_items is a collection variable that can be used to store input values for verification against actual data. | No |
File
Use this step to apply the file module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
path | textBox | path aliases: dest, name Path to the file being managed. |
No |
recurse | textBox | Recursively set the specified file attributes on directory contents. This applies only when state is set to directory. Choices: false ← (default) true |
No |
src | textBox | Path of the file to link to. This applies only to state=link and state=hard. For state=link, this will also accept a non-existing path. Relative paths are relative to the file being created (path) which is how the Unix command ln -s SRC DEST treats relative paths. |
No |
dest | textBox | This is optional due to providing similar input in “path” field. | No |
state | textBox | If absent, directories will be recursively deleted, and files or symlinks will be unlinked. In the case of a directory, if diff is declared, you will see the files and folders deleted listed under path_contents. Note that absent will not cause ansible.builtin.file to fail if the path does not exist as the state did not change. If directory, all intermediate subdirectories will be created if they do not exist. Since Ansible 1.7 they will be created with the supplied permissions. If file, with no other options, returns the current state of path. If file, even with other options (such as mode), the file will be modified if it exists but will NOT be created if it does not exist. Set to touch or use the ansible.builtin.copy or ansible.builtin.template module if you want to create the file if it does not exist. If hard, the hard link will be created or changed. If link, the symbolic link will be created or changed. If touch (new in Ansible 1.4), an empty file will be created if the file does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way touch works from the command line). Default is the current state of the file if it exists, directory if recurse=yes, or file otherwise. Choices: absent directory file hard link touch |
No |
owner | textBox | Name of the user that should own the filesystem object, as would be fed to chown. When left unspecified, it uses the current user unless you are root, in which case it can preserve the previous ownership. Specifying a numeric username will be assumed to be a user ID and not a username. Avoid numeric usernames to avoid this confusion. |
No |
group | textBox | Name of the group that should own the filesystem object, as would be fed to chown. When left unspecified, it uses the current group of the current user unless you are root, in which case it can preserve the previous ownership. |
No |
mode | textBox | The permissions of the destination file or directory. For those used to /usr/bin/chmod remember that modes are actually octal numbers. You must either add a leading zero so that Ansible’s YAML parser knows it is an octal number (like 0644 or 01777) or quote it (like ‘644’ or ‘1777’) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, u+rwx or u=rw,g=r,o=r). As of Ansible 2.3, the mode may also be the special string preserve. preserve means that the file will be given the same permissions as the source file. When doing a recursive copy, see also directory_mode. If mode is not specified and the destination file does not exist, the default umask on the system will be used when setting the mode for the newly created file. If mode is not specified and the destination file does exist, the mode of the existing file will be used. Specifying mode is the best way to ensure files are created with the correct permissions. |
No |
with_items | textAreaBox | with_items is a collection variable that can be used to store input values for verification against actual data. | No |
Get URL
Use this step to apply the get_url module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
url | textBox | HTTP, HTTPS, or FTP URL in the form (http OR https OR ftp://[user[:pass]]@host.domain[:port]/path). | Yes |
dest | textBox | Absolute path of where to download the file to. If dest is a directory, either the server provided filename or, if none provided, the base name of the URL on the remote server will be used. If a directory, force has no effect. If dest is a directory, the file will always be downloaded (regardless of the force and checksum option), but replaced only if the contents changed. |
Yes |
checksum | textBox | If a checksum is passed to this parameter, the digest of the destination file will be calculated after it is downloaded to ensure its integrity and verify that the transfer completed successfully. Format: If you worry about portability, only the sha1 algorithm is available on all platforms and python versions. The Python hashlib module is responsible for providing the available algorithms. The choices vary based on Python version and OpenSSL version. On systems running in FIPS compliant mode, the md5 algorithm may be unavailable. Additionally, if a checksum is passed to this parameter, and the file exist under the dest location, the destination_checksum would be calculated, and if checksum equals destination_checksum, the file download would be skipped (unless force=true). If the checksum does not equal destination_checksum, the destination file is deleted. If the checksum URL requires username and password, url_username and url_password are used to download the checksum file. Default: "" |
No |
owner | textBox | Name of the user that should own the filesystem object, as would be fed to chown. When left unspecified, it uses the current user unless you are root, in which case it can preserve the previous ownership. Specifying a numeric username will be assumed to be a user ID and not a username. Avoid numeric usernames to avoid this confusion. |
No |
group | textBox | Name of the group that should own the filesystem object, as would be fed to chown. When left unspecified, it uses the current group of the current user unless you are root, in which case it can preserve the previous ownership. |
No |
mode | textBox | The permissions of the destination file or directory. For those used to /usr/bin/chmod remember that modes are actually octal numbers. You must either add a leading zero so that Ansible’s YAML parser knows it is an octal number (like 0644 or 01777) or quote it (like ‘644’ or ‘1777’) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, u+rwx or u=rw,g=r,o=r). As of Ansible 2.3, the mode may also be the special string preserve. preserve means that the file will be given the same permissions as the source file. When doing a recursive copy, see also directory_mode. If mode is not specified and the destination file does not exist, the default umask on the system will be used when setting the mode for the newly created file. If mode is not specified and the destination file does exist, the mode of the existing file will be used. Specifying mode is the best way to ensure files are created with the correct permissions. |
No |
Line In File
Use this step to apply the lineinfile module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
dest | textBox | The file to modify. Before Ansible 2.3 this option was only usable as dest, destfile and name. |
Yes |
regexp | textBox | The regular expression to look for in every line of the file. For state=present, the pattern to replace if found. Only the last line found will be replaced. For state=absent, the pattern of the line(s) to remove. If the regular expression is not matched, the line will be added to the file in keeping with insertbefore or insertafter settings. When modifying a line the regexp should typically match both the initial state of the line as well as its state after replacement by line to ensure idempotence. Uses Python regular expressions. See https://docs.python.org/3/library/re.html. |
No |
state | textBox | Whether the line should be there or not. Choices: </b> absent present ← (default) |
No |
line | textBox | The line to insert/replace into the file. Required for state=present. If backrefs is set, may contain backreferences that will get expanded with the regexp capture groups if the regexp matches. |
Yes |
insertbefore | textBox | Used with state=present. If specified, the line will be inserted before the last match of specified regular expression. If the first match is required, use firstmatch=yes. A value is available; BOF for inserting the line at the beginning of the file. If specified regular expression has no matches, the line will be inserted at the end of the file. If regular expressions are passed to both regexp and insertbefore, insertbefore is only honored if no match for regexp is found. May not be used with backrefs or insertafter. |
No |
with_items | textAreaBox | with_items is a collection variable that can be used to store input values for verification against actual data. | No |
Pip
Use this step to apply the pip module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
name | textBox | The name of a Python library to install or the url(bzr+,hg+,git+,svn+) of the remote package. This can be a list (since Ansible 2.2) and contain version specifiers (since Ansible 2.7). |
Yes |
state | textBox | The state of module. The forcereinstall option is only available in Ansible 2.1 and above. Choices: absent forcereinstall latest present ← (default) |
No |
with_items | textAreaBox | with_items is a collection variable that can be used to store input values for verification against actual data. | No |
Apt
Use this step to apply the apt module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
aptName | textBox | name aliases: package, pkg A list of package names, like foo, or package specifier with version, like foo=1.0 or foo>=1.0. Name wildcards (fnmatch) like apt* and version wildcards like foo=1.0* are also supported. Do not use single or double quotes around the version when referring to the package name with a specific version, such as foo=1.0 or foo>=1.0. |
No |
pkg | textBox | This is optional due to providing similar input in “aptName” field. | No |
deb | textBox | Path to a .deb package on the remote machine. If :// in the path, ansible will attempt to download deb before installing. (Version added 2.1) Requires the xz-utils package to extract the control file of the deb package to install. |
No |
state | textBox | Indicates the desired package state. latest ensures that the latest version is installed. build-dep ensures the package build dependencies are installed. fixed attempt to correct a system with broken dependencies in place. Choices: absent build-dep latest present ← (default) fixed |
No |
update_cache | textBox | aliases: update-cache Run the equivalent of apt-get update before the operation. Can be run as part of the package installation or as a separate step. Choices: false true |
No |
with_items | textAreaBox | with_items is a collection variable that can be used to store input values for verification against actual data. | No |
Service
Use this step to apply the service module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
name | textBox | Name of the service. | Yes |
enabled | textBox | Whether the service should start on boot. At least one of state and enabled are required. Choices: false true |
No |
state | textBox | started/stopped are idempotent actions that will not run commands unless necessary. restarted will always bounce the service. reloaded will always reload. At least one of state and enabled are required. Note that reloaded will start the service if it is not already started, even if your chosen init system wouldn’t normally. Choices: reloaded restarted started stopped |
No |
Shell
Use this step to apply the shell module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
shell | textBox | The shell module takes a free form command to run, as a string. | Yes |
async | textBox | The async keyword triggers Ansible to run the task in the background which can be checked (or) followed up later, and its value will be the maximum time that Ansible will wait for that particular Job (or) task to complete before it eventually times out or complete. So async keyword can tell Ansible how long the task should be allowed to run before Ansible gives it up and time out. But How would ansible track the status of this job invoked in the background? How frequent it would check if the task is completed or not. That’s where the poll keyword is coming into the picture. |
No |
poll | textBox | The Poll keyword is auto-enabled whenever you use async and it has a default value as 10 seconds Which means If you are not defining the poll keyword with customized time period. By default Ansible would track the status of the async task every 10 seconds. If you think 10 seconds polling is too frequent and you want Ansible to test the status of the job every 60 seconds It is possible. The poll keyword accepts a numeric value to know how many seconds it should wait before polling or following up with the long-running asynchronous task. In other words, The value of the poll indicates how often to poll and check if the tasks are completed. The default poll value is 10 seconds. |
No |
chdir | textBox | Change into this directory before running the command. | No |
Unarchive
Use this step to apply the unarchive module in Ansible.
Name | Type | Description | Required |
---|---|---|---|
src | textBox | If remote_src=no (default), local path to archive file to copy to the target server; can be absolute or relative. If remote_src=yes, path on the target server to existing archive file to unpack. If remote_src=yes and src contains ://, the remote machine will download the file from the URL first. (version_added Ansible 2.0). This is only for simple cases, for full download support use the ansible.builtin.get_url module. |
Yes |
dest | textBox | Remote absolute path where the archive should be unpacked. The given path must exist. Base directory is not created by this module. |
Yes |
copy | textBox | If true, the file is copied from local controller to the managed (remote) node, otherwise, the plugin will look for src archive on the managed machine. This option has been deprecated in favor of remote_src. This option is mutually exclusive with remote_src. Choices: false true ← (default) |
No |
creates | textBox | If the specified absolute path (file or directory) already exists, this step will not be run. The specified absolute path (file or directory) must be below the base path given with dest. |
No |
owner | textBox | Name of the user that should own the filesystem object, as would be fed to chown. When left unspecified, it uses the current user unless you are root, in which case it can preserve the previous ownership. Specifying a numeric username will be assumed to be a user ID and not a username. Avoid numeric usernames to avoid this confusion. |
No |
group | textBox | Name of the group that should own the filesystem object, as would be fed to chown. When left unspecified, it uses the current group of the current user unless you are root, in which case it can preserve the previous ownership. |
No |
become | textBox | The become keyword uses existing privilege escalation tools like sudo, su, pfexec, doas, pbrun, dzdo, ksu, runas, machinectl and others. set to true OR yes to activate privilege escalation. | No |
AShell
Use this step for Automation shell using raw Ansible step script.
The Ansible plugin allows Deploy to execute various Ansible module commands, any missing commands can be executed through an AShell plugin step.
Name | Type | Description | Required |
---|---|---|---|
script | textAreaBox | Ansible-styple script | Yes |
GetBuiltInAnsibleProperties
Use this step for Read Built-in Ansible variables(ansible_facts). It is similar to the Ansible setup module, where the queryKey parameter is equivalent to the filter parameter.
Name | Type | Description | Required |
---|---|---|---|
queryKey | textBox | query key can be ansible_lsb | Yes |
resultKey | textBox | result key can be codename for ansible_lsb.codename | Yes |
Apt Key
Use this step to apply the apt_key module in Ansible.
Note:
- The apt-key command used by this module has been deprecated. See the Debian wiki(https://wiki.debian.org/DebianRepository/UseThirdParty) for details.
This module is kept for backwards compatibility for systems that still use apt-key as the main way to manage apt repository keys.
Reference Ansible Official Documentation: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_key_module.html- In the next release of the plugin, this step will be removed.
Name | Type | Description | Required |
---|---|---|---|
data | textBox | The keyfile contents to add to the keyring. | Yes |
Back to … | Latest Version | Ansible Plug-In | ||||
---|---|---|---|---|---|---|
All Plugins | Deploy Plugins | 55.1173239 | Readme | Overview | Usage | Downloads |