Runs sRuns an Ansible playbook YAML file. This operation takes a name or path of the specific playbook file as well as any desired arguments and runs the playbook.
Environment/Instance Properties
...
...
...
...
Project Properties
...
...
...
...
Input
...
Inputs
Input Name | Input Code | Required | Description |
---|---|---|---|
Ansible Home |
| No | Absolute directory path where Ansible is installed. |
Ansible Playbook |
| Yes | Absolute or relative path to Ansible playbook YAML file. Relative |
paths will be looked for in both the temp and artifact directory. Absolute Path Example: /home/ubuntu/ansibleTest/testPlaybook.yml Relative Path Example: ansibleTest/testPlaybook.yml | |||
Inventory File |
| No | Absolute path to the inventory file to use with the playbook invocation. (CLI arg: -i) |
Become Method |
| No | Privilege escalation method to use. (CLI arg: --become-method) valid choices: [ sudo | su | pbrun | pfexec | doas | dzdo | ksu | runas | machinectl ] If privilege escalation method is selected -b CLI argument will be passed. |
Become User |
| No | Run operations as. (CLI arg: --become-user) If value is provided -b CLI argument will be passed. |
Extra Variables |
| No | Additional variables as key=value, JSON text, or a JSON/YAML file. Formatted as key=value. If passing a JSON/YAML file, you must use an @ before the file name. One pair per line (CLI arg: -e) Key/Value Example: var1=val1 var2=val1" JSON Example: {"version":"1.23.45","other_variable":"foo"} JSON/YAML File Example: @some_file.json |
Parallel Processes |
| No | Number of parallel processes to use. (CLI arg: -f) |
Host Limit |
| No | Limiting of the selected hosts to an additional pattern. Outputs a list of matching hosts. If more than one the different tags must be separated by a comma. (CLI arg: -l) Multiple Hosts Example: host1, host2 |
Skip Tags |
| No | Only run plays and tasks whose tags do not match these values. If more than one the different tags must be separated by a comma. (CLI arg: --skip-tags) Multiple Tags Example: configuration,packages |
Start at Task |
| No | Start the playbook at the task matching this name. (CLI arg: --start-at-task) |
Run Tags |
| No | Only run plays and tasks tagged with these values. If more than one the different tags must be separated by a comma. (CLI arg: -t) Multiple Tags Example: configuration,packages |
Outputs
Artifacts
This operation delegates consumes artifacts from the artifacts repository/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 will select delegates endpoint selection to the workflow developer. The workflow editor will default the selection to "All", which selects all available endpoints associated to the environment/instance. Ansible 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. This operation will execute on any one of the selected endpoints and will be random in the determination of which one.
...
Below you can see an example of inputs used on the runAnsiblePlaybook plugin operation.
...
Below is the Ansible playbook that is saved in /home/ubuntu/ansibleTest. This plugin verifies that Apache is up to date, starts the server if it is not running, and stops the server if it is running.
...
...
/home/ubuntu/ansibleTest/testPlaybook.yml
Code Block |
---|
--- - hosts: dkrlp01 # become: yes tasks: - name: verify latest version Apache apt: name: apache2 update_cache: yes state: latest - name: ensure httpd is running service: name: apache2 state: started - name: stop apache service: name: apache2 state: stopped |
Below is the hosts inventory file that is saved in /home/ubuntu/ansibleTest
Inventory file
Code Block | ||
---|---|---|
| ||
[apache] dkrlp01 ansible_ssh_host=dkrlp01.flexagon ansible_ssh_user=ubuntu ansible_ssh_pass=welcome1 [all:vars] ansible_sudo_pass=welcome1[webservers] www1.example.com www2.example.com [dbservers] db0.example.com db1.example.com |