Skip to main content

Ansible tasks

Step 1. Drop

  • Drop the AnsibleTasks component on a compute.

Fig. Bash component properties

Step 2. Write an Ansible task

  1. Click on the AnsibleTasks component to open the code editor.
  2. Copy and paste the following script in the code editor and Save File.
- debug:
- "{{ 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 value bar).
  • Set ansible_become to true to run the ansible tasks with root privileges. Defaults to false.
  • Set ignore_errors to true for the orchestrator to ignore any errors during the execution of this ansible tasks and continues. Defaults to false.

Fig. Ansible tasks

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