Jump to section

What is Infrastructure as Code (IaC)?

Copy URL

Infrastructure as Code (IaC) is the managing and provisioning of infrastructure through code instead of through manual processes.

With IaC, configuration files are created that contain your infrastructure specifications, which makes it easier to edit and distribute configurations. It also ensures that you provision the same environment every time. By codifying and documenting your configuration specifications, IaC aids configuration management and helps you to avoid undocumented, ad-hoc configuration changes.

Version control is an important part of IaC, and your configuration files should be under source control just like any other software source code file. Deploying your infrastructure as code also means that you can divide your infrastructure into modular components that can then be combined in different ways through automation.

Automating infrastructure provisioning with IaC means that developers don’t need to manually provision and manage servers, operating systems, storage, and other infrastructure components each time they develop or deploy an application. Codifying your infrastructure gives you a template to follow for provisioning, and although this can still be accomplished manually, an automation tool, such as Red Hat® Ansible® Automation Platform, can do it for you.

There are 2 ways to approach IaC: declarative or imperative. 

A declarative approach defines the desired state of the system, including what resources you need and any properties they should have, and an IaC tool will configure it for you. 

A declarative approach also keeps a list of the current state of your system objects, which makes taking down the infrastructure simpler to manage.

An imperative approach instead defines the specific commands needed to achieve the desired configuration, and those commands then need to be executed in the correct order. 

Many IaC tools use a declarative approach and will automatically provision the desired infrastructure. If you make changes to the desired state, a declarative IaC tool will apply those changes for you. An imperative tool will require you to figure out how those changes should be applied.

IaC tools are often able to operate in both approaches, but tend to prefer one approach over the other.

Provisioning infrastructure has historically been a time-consuming and costly manual process. As virtualizationcontainers, and cloud computing have become the norm, infrastructure management has moved away from physical hardware in data centers—providing many benefits, but also creating some new challenges.

With cloud computing, the number of infrastructure components has grown, more applications are being released to production on a daily basis, and infrastructure needs to be able to be spun up, scaled, and taken down frequently. Without an IaC practice in place, it becomes increasingly difficult to manage the scale of today’s infrastructure.

IaC can help your organization manage IT infrastructure needs while also improving consistency and reducing errors and manual configuration.


  • Cost reduction
  • Increase in speed of deployments
  • Reduce errors 
  • Improve infrastructure consistency
  • Eliminate configuration drift

Extending IaC strategy into Day 2 operations

Building on the strategic foundation of IaC, organizations are beginning to use these practices to automate IT processes at every stage of the operational life cycle. 

Just as IaC standardizes the build, provisioning, and deployment of infrastructure, IT teams can adopt Ops as Code (OaC) to codify the management and maintenance of systems after they are deployed. This approach can then be extended into Policy as Code (PaC) to automate governance, risk, and compliance processes for applications and solutions.

Using the experience gained from automating IaC, IT teams can use the same methods and tools to take a more efficient, adaptable approach to Day 2 operations.

Server automation and configuration management tools can often be used to achieve IaC. There are also solutions specifically for IaC. 

These are some popular choices:

Using an automation tool to implement IaC can also help to build more efficient, productive workflows and streamline the adoption of a NetOps methodology. Comprehensive platforms, like Ansible Automation Platform, can be used to provision operating systems and network devices, deploy applications, and manage configuration across enterprise environments.

Want to learn more about the differences between Ansible and Red Hat Ansible Automation Platform?

IaC is an important part of implementing DevOps practices and continuous integration/continuous delivery (CI/CD). IaC takes away the majority of provisioning work from developers, who can execute a script to have their infrastructure ready to go. That way, application deployments aren’t held up waiting for the infrastructure, and sysadmins aren’t managing time-consuming manual processes. 

CI/CD relies on ongoing automation and continuous monitoring throughout the application life cycle, from integration and testing to delivery and deployment. In order for an environment to be automated, it needs to be consistent. Automating application deployments doesn’t work when the development team deploys applications or configures environments one way and the operations teams deploys and configures another way.

Aligning development and operations teams through a DevOps approach leads to fewer errors, manual deployments, and inconsistencies. IaC helps you to align development and operations because both teams can use the same description of the application deployment, supporting a DevOps approach.

The same deployment process should be used for every environment, including your production environment. IaC generates the same environment every time it is used. IaC also removes the need to maintain individual deployment environments with unique configurations that can’t be reproduced automatically and ensures that the production environment will be consistent.

DevOps best practices are also applied to infrastructure in IaC. Infrastructure can go through the same CI/CD pipeline as an application does during software development, applying the same testing and version control to the infrastructure code.

Creating an enterprise-wide approach to automation lets you automate not only IT processes, but also entire technologies, teams, and organizations. 

Red Hat Ansible Automation Platform includes all the tools needed to implement enterprise-wide automation, including playbooks, a visual dashboard, an event-driven solution, and analytics. It also uses webhooks to automate IaC workflows and enable GitOps practices.

Ansible Playbooks, written in YAML, describe the desired state of your systems, which are usually kept in source control. Ansible Automation Platform does the work of getting your systems to the desired state, no matter their current state. 

Ansible Automation Platform makes your installations, upgrades and day-to-day management repeatable and reliable.

With an Ansible Automation Platform subscription, you can deploy new applications and services faster, manage IT infrastructure more efficiently, and see an increase in app development productivity. And you’ll get access to certified content from our robust partner ecosystem, hosted management services, and life cycle technical support so your teams can create, manage, and scale automation across your organization.

Icon-Red_Hat-Media_and_documents-Quotemark_Open-B-Red-RGB The built-in capabilities of Red Hat Ansible Automation Platform provide an accelerator in a box. It’s the de facto standard that many of our vendors and partners also use to write scripts to install, configure, and maintain their technology.

Jesse Amerson

IT director, Ulta Beauty

How much time can automation save you?

Answer a few short questions to find out how much time you could save by using Ansible Automation Platform across your organization.

Keep reading


Learning Ansible basics

Ansible automates IT processes like provisioning and configuration management. Learn the basics of Ansible with this introduction to key concepts.


What's an Ansible Playbook?

An Ansible Playbook is a blueprint of automation tasks, which are IT actions executed with limited manual effort across an inventory of IT solutions.


Why choose Red Hat for automation?

Red Hat Ansible Automation Platform includes all the tools needed to share automation across teams and implement enterprise-wide automation.

More about automation


A unified solution that combines the security, features, integrations, and flexibility needed to scale automation across domains, orchestrate essential workflows, and optimize IT operations for AI adoption. 

Engagements with our strategic advisers who take a big-picture view of your organization, analyze your challenges, and help you overcome them with comprehensive, cost-effective solutions.



Red Hat Ansible Automation Platform: A beginner’s guide

Customer Success Stories

See how our customers have used Ansible Automation Platform to accelerate IT operations


Code Comments Season 2: Hear how organizations have adapted to do more with IT automation 


Learning hub

Explore learning materials and tools designed to help you use Ansible Automation Platform, organized by the tasks you need to accomplish. 

Interactive Labs

These interactive scenarios let you start learning how to use Ansible Automation Platform for a variety of use cases—in your own browser. 

Technical Overview

This series of on-demand videos introduces you to using Ansible Automation Platform for a variety of use cases across IT environments.


This course will teach you how to automate Linux® system administration tasks with the latest version of Ansible Automation Platform.