Can’t get enough of automating your business processes? We have what you are looking for!
The Ansible plug-in is available on Automation Hub, download it to empower your Workload Automation environment.
Adding the Ansible plug-in, you can monitor all your Ansible processes directly from the Dynamic Workload Console. Furthermore, you can schedule when executing the Ansible playbooks, just creating a simple job definition.
Before starting to use the plug-in, you need to install Ansible on the same machine where the dynamic agent that runs the Ansible job is installed. You also need to setup the SSH protocol to communicate with Ansible.
Let’s demonstrate, through an example, how easy is to patch remote nodes with the Ansible plug–in.
- Job definition
- First, we need the code to patch the remote nodes, and usually it is written through a yum module in a yaml file. This kind of file is called playbook.yml, and we can add it by using the playbook path field. In the field we need to enter the absolute path to the playbook.yml file; we can use the Search button to search such path in the dynamic agent’s file system. The content of the file is the following:
—
– hosts: all
name: Update packages
tasks:
– name: Update
yum:
name: ” {{ module_name }} “
state: latest
- Then we need to valorize the variable “module_name” as an extra argument to correctly execute the playbook. Thus, in the Environment variables section we insert, for example, “module_name” in the Name column and an asterisk (*) in the Value column.
The asterisk indicates that Ansible will update all modules found on the target machine.
- Next, we need to specify the remote nodes to which Ansible should connect. The file with the targets’ list is called inventory and the Inventory section contains the path to such file (or files, since Ansible can consider multiple inventories at once). The Search inventories button allows to search for such paths in the file system of the dynamic agent, starting from the path written just above the button.
We want to update modules on localhost and on a remote machine, so our inventory file content is as follows:
[LOCAL]
localhost ansible_connection=local
[REMOTE]
node_name ansible_ssh_user=<username> ansible_ssh_host=<ip>
We configured all necessary fields to make Ansible work, but if we want, we can also configure some additional options, such as:
- Check for unreachable hosts before running: when this option is selected, the plug–in forces Ansible to execute the ping module towards all hosts. If at least one host is unreachable, the plug–in stops and ends in error showing the list of unreachable hosts. If all hosts are reachable, the playbook execution starts.
- The Inventory content field gives the possibility to write an inventory directly in the job definition, without the need for a file stored in the file system of the dynamic agent.
- The ansible-playbook command accepts some additional parameters that can be written in the Other parameters field. For example, the –verbose parameter is used to get a more verbose output.
2. Monitoring
While Ansible executes the playbook, the plug–in offers the possibility to monitor in real-time its execution. Such monitor page, called Workflow details, is accessible from the monitor jobs view and contains details of each task that Ansible has executed up to a particular point. Refresh the page to see the updates and click on the showAdditionalInfo button to get more details about a specific task.
Thus, thanks to the Ansible plug-in, you can automate your playbooks and monitor all your processes running on Ansible, all from one place.
On Automation Hub we have this and so many other integrations that will enable you to automate everything you want.
Automate more, automate better!
Author’s Bio:
Maria Ludovica Costagliola, Workload Automation Junior Software Developer
Maria joined HCL in September 2019 as Junior Software Developer starting to work as Developer for IBM Workload Automation product suite. She has a Computer Engineering Master Degree.
Agnese Berellini, Information Developer for HCL Workload Automation
Agnese is a very enthusiastic developer. She likes to analyze new features, describe them and improve her knowledge about technical components. When she doesn’t have to deal with developers and software, she loves spending her time travelling around the world.
Start a Conversation with Us
We’re here to help you find the right solutions and support you in achieving your business goals.