I know—everyone talks about AI. I talk about IT infrastructure automation using different tools. One of them is Ansible. I like using Ansible Automation Platform. The latest version has a clear interface. All versions have access control capabilities to define who can start which jobs. There is only one problem.
My problem is that I sometimes have too many job templates. Find the template you need! If you have several people automating a large environment with many different processes, each of them has their own ideas about how templates must be named and which parameters they should use. It can easily become a nightmare!
What about a self-service portal?
This was my evergreen idea. If you wish to make the next step in automation, create a self-service portal for your users. They can log in there, find what they want, and start the jobs. The same applies to you. You don’t need to see and search through all job templates in Ansible Automation Platform. You see them in your self-service portal.
The only problem with the self-service portal - someone must build it.
I don’t know any ready-to-use solutions. The best I can imagine is to create one more user on the Ansible Automation Platform and give them access to fewer templates.
Why AI?
It would be nice if I could simply tell a chatbot what I want to do, and it would find suitable templates in the Ansible Automation Platform.
Great idea?
Unfortunately, I had problems implementing it. Till this week.
This week, I found a new tool for me - n8n. What took so much time before was done in one evening. I think I write this post longer than it took to develop the AI automation for Ansible.
Now I have a chatbot I can ask to perform actions. It looks through my Ansible Automation Platform templates and executes what I need.
OK, let me disappoint you about the screenshot. It is a real screenshot from a real AI chatbot session. It did what is shown in the screenshot and even more. But in this particular case, I used a commercial AI model. I tested several AI models from different vendors—free and commercial—and this one works best for me. But it costs tons of money.
Everything else is free of charge, at least for testing. Of course, you can use free AI models. While I developed this “chatbot”, I used the free Google Gemini API. It worked very well, but from time to time, it produced errors.
What should you do if you want to have your own chatbot?
You need an x86 Linux server with docker or podman. Sorry, n8n doesn’t work on IBM Power. I think IBM must push them to port it to IBM Power and make some WatsonX workflow nodes. It would be really great to have such a tool for enterprise automation.
The installation is described on the n8n site and is really easy.
The step that would take more time is developing the so-called workflow. But I help you.
As you see, it is not huge. It is very small.
The workflow starts with the node “When chat message received”. This trigger creates a chatbot and wait for a message in the chat.
Of course, if you want to use the chatbot, you must enable authentication. Otherwise, everyone can start your Ansible jobs. You can also define the name of your bot and the greeting.
The next step is to define an AI Agent:
You define the base prompt in the System Message. Be as specific as you can.
I am not an AI prompt writer. I think it took me most of the time to define it. I felt like writing an operations handbook for a junior system administrator.
You are an experienced system administrator and can do different tasks like deploying Linux and AIX systems, configuring networks, SAN, and storage. You can work with Microsoft Azure, IBM Cloud and Skytap. According to the request, you propose the best possible solution. You use the tools defined below to get tasks done.
Actual date: {{ $now }}
# Rules
Before answering any inquiry, start the tool “Get list of Ansible templates”.
Check through the list of available job templates. For each result you save the following information:
- ID of the job template
- Name of the job template
- Description of the job template
You analyze the user’s inquiry and the information you’ve got, and if you find a suitable job template, you start it by calling the tool ‘Launch Job on Ansible Automation Platform’ with the corresponding job id as parameter template_id.
If the job restarts or resets a virtual machine, you must ask for the confirmation from the user and do it only, if the user confirms the action. You MUST provide the parameter vm_id to the restart job. You can find all VM IDs by executing the job “List Skytap VMs” before you launch the job to restart the VM.
If the Ansible job is successfully executed, you answer that the job is done. If the user wants to see the output of the job, you execute ‘Get Job Output’ with id of the last job and send it to the user.
If the Ansible job is failed, you send the output of the job to the chat.
If you don’t find a suitable Ansible template, you search through other tools if they can help to execute the inquiry.
If you don’t find anything suitable, you let the user know, that you don’t know how to execute. Propose a best suitable advice for the user.
I think you can do it better than I. Again, I am not an AI prompt engineer and wanted only that it can start my Ansible playbooks.
After you have defined the prompt, you add an AI model from the list of available models and a database to store the conversation.
At this point, your new chatbot works, but it still can’t start any Ansible jobs.
I added three more workflows and call them as “tools” for my AI agent:
- Get list of available Ansible templates 
- Launch job on Ansible Automation Platform 
- Get job output from Ansible Automation Platform 
All three tools are defined the same way - to call another workflow.
Get Job output from Ansible Automation Platform
This is the easiest sub-workflow and contains only two nodes - to start and to execute an HTTP request to the Ansible Automation Platform.
It becomes one parameter - job_id:
This parameter then goes into the HTTP request:
Get the list of available Ansible templates
This sub-workflow is more complex, and I changed the data I’ve got from Ansible. I want to have it simple and throw away everything I don’t need.
This workflow has no parameters and simple executes one HTTP request. In my case it is call to https://ansible.power-devops.cloud/api/controller/v2/job_templates/. The results I got from Ansible are split up into separate “items”:
And after it, I select only three fields from the results:
I don’t need any other fields for my AI Agent to understand what it can do.
Launch job on Ansible Automation Platform
This is the most complex workflow. I wanted to add some logic into it - check the incoming parameters, wait until the job is finished, and understand the result of the job run.
The central nodes here are those that launch job templates and get results. These are HTTP requests to Ansible Automation Platform.
The node that requires VM ID has an additional field:
To make it easy and avoid too many screenshots, I saved the workflow in a JSON file. You can download it from my site, change the extension to .json, and upload it to your n8n instance if you wish.
Support the Power DevOps Newsletter!
If you like reading technical articles about IBM Power, AIX, and Linux on IBM Power, consider upgrading to the paid tier to show your support. As a paid subscriber, you not only get regular posts, but you will get additional posts with the full code and further explanations, access to the whole archive of the blog, and take part in our monthly calls where you can ask your questions and propose topics for future newsletters. Be an active member of our community!
Andrey, you talk too much about Ansible Automation Platform!
Yes, because I like it.
But no worries if you don’t have it.
Of course, it makes the job more difficult. But n8n has an SSH node you can use to log in to a server with Ansible installed and run ansible-playbook there. It means you probably need to define a separate workflow for each of your playbooks. On the other side, you can find better ways to get the list of the playbooks.
Create your own AI chatbot and
Have fun with it!
Andrey
Hi, I am Andrey Klyachkin, IBM Champion and IBM AIX Community Advocate. This means I don’t work for IBM. Over the last twenty years, I have worked with many different IBM Power customers all over the world, both on-premise and in the cloud. I specialize in automating IBM Power infrastructures, making them even more robust and agile. I co-authored several IBM Redbooks and IBM Power certifications. I am an active Red Hat Certified Engineer and Instructor.
Follow me on LinkedIn, Twitter and YouTube.
You can meet me at events like IBM TechXchange, the Common Europe Congress, and GSE Germany’s IBM Power Working Group sessions.
















