Infrastructure as Code (IAC) is a type of IT infrastructure that operations teams can automatically manage and provision through code, rather than using a manual process. Infrastructure as Code is sometimes referred to as programmable infrastructure.
The concept of IAC is similar to programming scripts, which are used to automate important IT processes. However, scripts are primarily used to automate a series of static steps that must be repeated numerous times across multiple servers. Instead of scripts, IAC uses higher-level or descriptive language to code more versatile and adaptive provisioning and deployment processes.
For example, IAC that is coded with Ansible, an IT management and configuration tool, could install MySQL server, verify that MySQL is running properly, create a user account and password, set up a new database and remove unneeded databases – all through code.
The IAC process closely resembles formal software design practices in which developers carefully control code versions, test code iterations and limit deployment until the software is proven and approved for production.
Using code to provision and deploy servers and applications is particularly interesting to software developers. Rather than rely on system administrators to provision and manage the operations aspect of a DevOps environment, a developer can write an IAC process to provision and deploy a new application for quality assurance or experimental deployment.
Despite its benefits, IAC poses potential disadvantages. For example, IAC code development may require additional tools that could introduce learning curves and room for error. Any errors in IAC code can proliferate quickly through servers, making it essential to monitor version control and comprehensive pre-release testing.
If administrators change server configurations without changing IAC code, there is potential for configuration drift, which is when inconsistent configurations exist across data center systems. It's important to fully integrate IAC into systems administration, IT operations and DevOps processes with well-documented policies and procedures.
In addition to Ansible, common tools for enabling IAC include Vagrant, Puppet and Chef.