Ansible for CCNA: Automate Configuration Across Many Devices
Ansible automates the configuration of many devices from a control node: it reads an inventory, runs a playbook written in YAML and connects over SSH without installing agents. It is one of the configuration management tools the CCNA mentions along with Puppet, Chef and Terraform.

Edit this template Download .json
Learning objectives
- Describe inventory, playbook, module and control node.
- Compare agent-based and agentless tools, and push and pull models.
- Read a simple playbook that sets a banner on several devices.
Devices and addressing
| Device | Type | Details |
|---|---|---|
| Control node | ANS | Ansible inventory.ini · playbook.yml |
| R1 | Router | Managed SSH · 10.0.0.1 |
| R2 | Router | Managed SSH · 10.0.0.2 |
| SW1 | Switch | Managed SSH · 10.0.0.3 |
| SW2 | Switch | Managed SSH · 10.0.0.4 |
Reference configuration (Cisco IOS)
inventory.ini
[red]
r1 ansible_host=10.0.0.1
r2 ansible_host=10.0.0.2
sw1 ansible_host=10.0.0.3
sw2 ansible_host=10.0.0.4
[red:vars]
ansible_connection=network_cli
ansible_network_os=ios
ansible_user=admin
ansible_password=Cl4ve-Segura!
playbook.yml
- name: Configurar banner en todos los equipos
hosts: red
gather_facts: false
tasks:
- name: Banner MOTD
cisco.ios.ios_banner:
banner: motd
text: "Acceso solo a personal autorizado"
state: present
- name: Guardar configuración
cisco.ios.ios_config:
save_when: modified
Verification commands
ansible-inventory -i inventory.ini --listansible red -i inventory.ini -m pingansible-playbook -i inventory.ini playbook.yml --checkansible-playbook -i inventory.ini playbook.yml
CCNA exam tips
Ansible: agentless, push, YAML, SSH/NETCONF. Puppet and Chef: agent-based, pull, own language (Ruby).
Terraform is declarative and used mostly for infrastructure as code in the cloud.
How to use this template
Press “Edit this template”: the editor opens with the topology loaded and ready to change (undo with Ctrl+Z). You can also copy the JSON and paste it into the editor with File ▸ Import JSON…. Then add devices, change IPs and export to PDF, PNG or SVG.
To practice, rebuild the topology in Cisco Packet Tracer, GNS3 or Cisco Modeling Labs and paste the reference configuration on each device. Addresses and names are examples: change them to create your own variants.
JSON template for the editor
This is the full diagram in JSON format. Paste it into the editor (File ▸ Import JSON…) or press the edit button to load it automatically.
Frequently asked questions
What is the difference between Ansible and Puppet?
Ansible needs no agents and pushes configuration over SSH; Puppet installs an agent that polls the master server.
What is a playbook?
A YAML file describing the tasks to run on the inventory devices.