6.6 Recognize what Ansible and Terraform do for configuration management
CCNA 200-301 v1.1 · 6.0 Automation and Programmability
Ansible and Terraform are the configuration management tools the CCNA expects you to recognise. Ansible runs tasks from YAML playbooks over SSH or APIs, with no agent on the devices; Terraform describes the desired infrastructure in HCL and creates or changes it to match. Both keep configuration in files you can review and version.
What you must know
- Describe Ansible: agentless, push model, inventory, playbooks in YAML, modules.
- Describe Terraform: declarative HCL, providers, plan and apply, state file.
- Compare the two: procedural tasks versus declared end state, typical uses.
- Mention Puppet and Chef as agent-based, pull-model tools.
Ansible
Ansible connects from a control node to devices listed in an inventory, over SSH (or NETCONF and APIs), and runs tasks from a playbook written in YAML. Each task calls a module (such as cisco.ios.ios_vlans or ios_config). There is no agent to install on the devices, which suits network gear.
- name: Standard VLANs on every access switch
hosts: access_switches
gather_facts: false
tasks:
- name: VLANs 10 and 20
cisco.ios.ios_vlans:
config:
- vlan_id: 10
name: USERS
- vlan_id: 20
name: VOICE
state: mergedThe control node pushes the change to each device in turn (1).
Terraform
Terraform describes resources in HCL files: what should exist, not the steps to make it. Providers talk to each platform's API (clouds, Meraki, Catalyst Center, ACI). terraform plan shows what would change; terraform apply makes it so, and a state file remembers what Terraform manages. It is strongest for building infrastructure such as cloud networks, VPCs and SD-WAN or Meraki objects.
| Ansible | Terraform | Puppet / Chef | |
|---|---|---|---|
| Language | YAML playbooks | HCL | Puppet DSL / Ruby |
| Style | Mostly procedural (tasks in order) | Declarative (end state) | Declarative / procedural |
| Agent | Agentless (push) | Agentless (API calls) | Agent on each node (pull) |
| Typical use | Device configuration | Provisioning infrastructure | Server configuration |
Commands
ansible-playbook -i inventory vlans.yml | Runs a playbook against the inventory. |
terraform plan / terraform apply | Previews and applies infrastructure changes. |
Exam traps
- Ansible is agentless and uses YAML; Puppet and Chef use agents.
- Terraform is declarative and keeps a state file.
terraform planchanges nothing;applydoes.
Check yourself
- Which tool uses YAML playbooks and needs no agent on switches?
- Ansible.
- What does
terraform plando? - Shows the changes Terraform would make, without making them.
More topics in 6.0 Automation and Programmability
- 6.1 Explain the effect of automation on network operations
- 6.2 Compare device-by-device management with controller-based management
- 6.3 Describe how overlay, underlay and fabric make up a software-defined network
- 6.4 Explain where generative AI, predictive AI and machine learning fit in network operations