Ansible tasks
Step 1. Drop
- Drop the AnsibleTasks component on a compute.
Step 2. Write an Ansible task
- Click on the AnsibleTasks component to open the code editor.
- Copy and paste the following script in the code editor and Save File.
- debug:
msg:
- "{{ NODE }} is running on {{ HOST }} on port {{ PORT }}"
- "{{ NODE }} has environment variable FOO with value: {{ FOO }}"
Step 3. Set Ansible variables
- All component properties are available as Ansible variables (e.g., set the port property to
8080
). - Use the property env to define any ansible variables (e.g., set the env property with key
FOO
valuebar
). - Set ansible_become to
true
to run the ansible tasks with root privileges. Defaults tofalse
. - Set ignore_errors to
true
for the orchestrator to ignore any errors during the execution of this ansible tasks and continues. Defaults tofalse
.
Expected result
During the deployment, the orchestrator executes the ansible tasks on the target Compute and prints out:
AnsibleTasks is running on Compute on port 8080
AnsibleTasks has environment variable FOO with value: bar