Skip to content
Welcome To Charanjit Cheema Blog

Welcome To Charanjit Cheema Blog

An Open Source and Cloud Blog

Menu
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
Menu

How to optimize the performance of Ansible Automation Platform or Ansible Tower

Posted on July 16, 2023July 23, 2023 by Charanjit Cheema

Red Hat Ansible Automation Platform (AAP) or Ansible Tower has become de facto Automation Tool for deploying the Automation projects to automate the System Administration tasks such as configuration management, application deployment, provisioning, orchestration, and continuous delivery.

Although AAP and Ansible Tower are designed to run on large scale Infrastructure environment but sometime running complex Ansible playbook tasks via AAP or Ansible Tower instance on such large scale infrastructure environment or running those playbooks which contains CPU or memory intensive tasks could toll on these Automation tools performance. When AAP or Ansible Tower start lagging in performance you can see large number of Ansible playbook jobs are in waiting queue or jobs are taking lot of time in completion, to counter such issues I have shared some simple steps through which System Admin can optimize the performance of AAP or Ansible Tower.

Although there are numbers of method either from ansible playbook coding or from AAP or Ansible Tower UI itself you can optimize playbook jobs execution performance but in this article, I am only covering some of below methods which can significantly improve these Automation tools performance:

  • Using of Ansible job Fork and Slicing
  • Enabling of pipeling and timeout options
  • Enabling Fact Storage or Fact cache in AAP or Ansible Tower job templates

 

Using of Fork and Slicing in in AAP or Ansible Tower job templates

Ansible Fork: Ansible Fork is equal to one process of Ansible Controller instance which utilizes its CPU and memory. By default, Ansible use 5 fork value which means each Ansible task in a playbook can be run on 5 endpoints at a time but say in case you want to run the ansible playbook on 100 endpoints at a time for reducing the runtime of job you can increase the fork value to 100.

Now there are two ways to increase the fork value in Ansible. One method is if you are developing your own ansible playbook, you can configure ansible.cfg file and define the fork value there as an example below:

 

Another method is to set fork value in AAP or Ansible Tower job templates as well which is easiest way, and you need not to change your existing Ansible configuration in your code repository like GitHub repo.

Example of Fork value set in AAP or Ansible Tower job templates:

 

Ansible Job Slicing: Contrary to fork method Ansible job slicing allows you to run Ansible playbook job in multiple Ansible controller instances simultaneously. By using slicing method AAP or Ansible Tower ensure that no single Ansible Controller instance should be overloaded as it distributes the jobs between multiple Ansible Controller instances and hence it speeds up the job execution as well. Ansible playbook job which is sliced as per the value sets in AAP or Ansible Tower job template it creates a numbers of job template nodes which is invoked by Ansible Workflow template and each job template node is equal to Ansible Controller instance on which job runs, as shown in below example:

 

Below is the example of Ansible Job template where you can define job slicing value and also you can see the instance groups name as well on which jobs can be distributed as per the value set in job slicing:

 

 

Enabling of pipeling and timeout options

Pipeling: As Ansible Controller instance use SSH for connecting with endpoints for executing several operations in background like copying the files, scripts and running the commands it can also increase the job runtime in AAP or Ansible Tower therefore enabling pipeline reduces this overload. Pipeline or SSH Pipelining is a new method of speeding up the SSH connection with endpoints by reducing the multiple SSH connections for executing the task. If you want to enable SSH pipeline for your developed playbook you can enable it in ansible.cfg configuration file:

 

There is also an alternative way to enable SSH Pipeline in AAP and Ansible Tower itself which will be applicable on all added hosts or endpoints inventory. To enable SSH Pipeline in AAP or Ansible Tower Go to Resources > Inventories > Click on your account Inventory and under inventory variable add below variable:
ansible_pipelining: ‘true’

Below is an example of AAP and Ansible Tower inventory variable:

AAP:

Ansible Tower:

 

SSH Timeout: SSH Timeout variable allows you to keep the SSH connection active with endpoints as per the defined time it helps in reducing the other Ansible job wait time in AAP and Ansible Tower if any Ansible job which needs to run on busy endpoints you can also increase the timeout value through this variable:

 

AAP:

 

Ansible Tower:

  

Enabling Fact Storage or Fact cache in AAP or Ansible Tower job templates

Facts are endpoints system variables information (such as OS information, hostname, network information, hardware information etc.) which is sometime needed by ansible playbook for running the further tasks based on gathered facts. In AAP or Ansible Tower some Ansible playbooks need gather facts (gather_facts: True) variable to capture the endpoints system information by running the setup module hidden task in background but using gather_facts variable on busy endpoint can increase the ansible playbook job runtime hence for addressing this issue AAP and Ansible Tower allows you to enable fact storage or fact cache in ansible job templates so that next time whenever any Ansible playbook job need endpoints facts variable it need not to gather it again from endpoints in this place it can take the input from stored facts variable.

Below are the examples of enabling Fact Storage or Fact cache in AAP or Ansible Tower job templates:

 

AAP:

Ansible Tower:

 

Below is the example of endpoint stored or cached facts variables:

 

Wrap up!

In this article you have read that there are two ways to tune the values and configure the variables for boosting the speed of Ansible jobs or improving the performance of AAP and Ansible Tower but one thing you need to note that if you have defined the tunable value and variables in your Automation project ansible.cfg configuration file in your GitHub repo and also same values and variables are configured in AAP and Ansible Tower as well in this case AAP and Ansible Tower values and variables will be superseded.

Loading

  • Author
  • Recent Posts
Charanjit Cheema
Follow him
Charanjit Cheema
Charanjit is currently working as a Cloud Architect at Mphasis, with 17 years of experience in IT infrastructure projects, implementation, and support. While his main role is as a DevOps engineer, he holds a Cloud Architect position and has strong skills in cloud technologies and automation. His expertise includes Terraform, Ansible, AWS, Azure DevOps, Azure Cloud, VMware, and Linux systems.

Charanjit is passionate about automating tasks and improving processes. He uses tools like Terraform and Azure DevOps to build and manage cloud infrastructure and streamline deployment. He also enjoys using Shell scripts and Ansible playbooks to make systems run more efficiently.

In his free time, Charanjit enjoys learning about new technologies and sharing his knowledge through his blog. When he’s not working, he likes listening to music, having a cup of coffee, and relaxing in nature.

You can connect with Charanjit on Twitter, Facebook, LinkedIn, or email him at charanjit.cheema@cjcheema.com.
Charanjit Cheema
Follow him
Latest posts by Charanjit Cheema (see all)
  • How to optimize the performance of Ansible Automation Platform or Ansible Tower - July 16, 2023
  • How to fix code and text file linting errors with the help of Visual Studio Code - June 27, 2023
  • How to migrate existing WordPress blog from AWS EC2 instance to Amazon Lightsail - May 29, 2023

Like this:

Like Loading...

Related

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tags

AWS Cloud Computing Dockers Networking Open Networking OpenSource RHEL-CentOS SDN Server Hardware SLES tcpdump Ubuntu WSL

Follow me @

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers

Recent Posts

  • How to Deploy Docker Containers with NGINX on AWS EC2 Using Ansible and GitHub Actions
  • No More DynamoDB! Use Native S3 locking for Terraform State
  • How to Bring and Manage Manually Created AWS Resources Under Terraform Management
  • Iterating Cloud Resource Provisioning Using Terraform Count and For_Each Meta-Arguments
  • Terraform and Ansible Collaboration for AWS Cloud Deployment

Recent Comments

  1. Charanjit Singh on Terraform and Ansible Collaboration for AWS Cloud Deployment
  2. christinatodd2020aeaa798563 on Terraform and Ansible Collaboration for AWS Cloud Deployment
  3. Charanjit Singh on How to Set password policy in CentOS or RHEL system
  4. SAURABH on How to recover or rebuild initramfs in CentOS 7 Linux
  5. Sangita on How to Set password policy in CentOS or RHEL system

Archives

  • April 2025
  • February 2025
  • January 2025
  • August 2024
  • July 2024
  • June 2024
  • January 2024
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • September 2022
  • August 2022
  • July 2020
  • May 2020
  • February 2020
  • November 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • June 2018
  • May 2018
  • April 2018

Categories

  • Automation
  • Cloud Computing
  • Coding
  • CyberSecurity
  • Networking
  • OpenSource
  • RHEL-CentOS
  • Server Hardware
  • SLES
  • Technical Blog
  • Ubuntu
  • WSL

Blog Stats

  • 18,353 hits
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
© 2025 Welcome To Charanjit Cheema Blog | Powered by Superbs Personal Blog theme
 

Loading Comments...
 

    %d