Skip to main content
@Since 11.2.0.0 Runs Ansible ad-hoc commands from a code snippet. Use this operation when you need to invoke ansible (for example ansible all -m ping) without writing a playbook. Each non-empty line in the snippet is executed as a separate command on the selected endpoint. If a line omits the ansible CLI, the plugin prefixes it. Lines that already start with ansible use the executable resolved from Ansible Home. Lines that start with ansible-, /, or . are executed as typed so you can call other Ansible CLIs or an explicit path.

Inputs

Input Name

Input Code

Required

Description

Ansible Home

FDANS_INP_ANSIBLE_HOME

No

Absolute directory path where Ansible is installed. When set, the plugin looks for the ansible executable in this directory or in a bin subdirectory.

Code Snippet

FDANS_INP_CODE_SNIPPET

Yes

Ansible ad-hoc commands to execute. Example: ansible all -m ping. The ansible CLI is prefixed when omitted. One command per line. A blank snippet fails validation.

Additional Arguments

FDANS_INP_ADDITIONAL_ARGS

No

Additional arguments appended to each Ansible command. (CLI arg: —vault-path)

Artifacts

This operation delegates consumes/produces artifacts decision to the workflow developer. Check Consumes Artifacts on the workflow step editor if this operation requires artifacts to be delivered prior to execution of the script. Check Produces Artifacts on the workflow step editor if this operation creates artifacts. The artifacts folder is available via the FD_ARTIFACTS_DIR variable.

Endpoint Selection

This operation delegates endpoint selection to the workflow developer. The workflow editor will default the selection to “All”, which selects all available endpoints associated to the target. Selecting a specific resource will result in selection of endpoints associated to the target which have that resource defined. Ansible must be installed on any endpoint that executes this plugin. The user can use the LOCALHOST endpoint if Ansible is installed on the FlexDeploy server.

Endpoint Execution

This operation delegates endpoint execution to the workflow developer. The workflow editor will default to “Any”, which will execute on any one of the selected endpoints, which will be randomly picked from selected endpoints or a specific endpoint where previous step may have executed. Changing this value to “All” to will result in execution on all selected endpoints.

Example

Full command in Code Snippet:
Args-only snippet (the plugin prefixes ansible):
Multiple commands, one per line: