Infrastructure as code (IaC) defines and manages servers, network devices, and other infrastructure through machine-readable configuration instead of manual, one-by-one operations. It addresses configuration drift, human error, inconsistent standards, and the poor scalability of manual administration. Configuration files describe the desired infrastructure state and the settings needed to achieve it, enabling version control, repeatable deployments, and automated provisioning, management, and decommissioning. section 25.0 section 25.2
Classify IaC and configuration-management tools along three operational dimensions:
- Agentless tools require no software agent on managed devices; agent-based tools require an installed agent. section 25.2
- Procedural tools specify ordered steps, whereas declarative tools specify the desired end state and determine how to reach it. section 25.2
- Push models send configuration from a management server; pull models have managed devices request configuration from the server. section 25.2
- Ansible, Terraform, Puppet, and Chef exemplify IaC, but they differ in language, architecture, workflow, and primary use. section 25.2 section 25.3
Network configuration as code
A shared configuration can combine fixed settings with variables: hostname {{hostname}}, NTP and logging servers, OSPF settings, and interface addresses such as {{g0/0addr}} and {{g0/0mask}}. A separate YAML variable file supplies values such as hostname R1, address 192.168.12.1, and mask 255.255.255.252. The resulting configuration can be applied consistently to multiple devices. section 25.2
Figure 25.3 Configuring devices with a configuration management tool. Configurations are centrally managed from a shared folder. A server running a configuration management tool applies configuration changes to devices.
Shows the central-management pattern: configuration files reside in a shared location, and a configuration-management server applies changes to managed devices. section 25.2
Distinguish the principal tools by their implementation model:
- Ansible uses YAML, SSH or NETCONF, an agentless push architecture, and a mainly procedural approach; its files include inventories, templates, variables, and playbooks. section 25.2 section 25.3
- Terraform uses HCL, an agentless push architecture, and a declarative approach; it primarily provisions new infrastructure rather than configuring existing devices. section 25.2.2 section 25.3
- Terraform’s Write-Plan-Apply workflow defines resources, previews changes, and executes the approved provisioning plan. section 25.2.2
- Puppet uses Ruby, Puppet DSL, agents, and a pull model; Chef shares Ruby, agent-based, and pull-oriented characteristics. section 25.2.3 section 25.2
Figure 25.6 Provisioning resources with Terraform. Configuration files are processed byTerraform Core to interact with various providers (i.e., public cloud providers) and manage infrastructure resources while maintaining state information in the state file.
Maps Terraform’s declarative path from configuration files through Terraform Core and providers to provisioned resources and maintained state. section 25.2.2













