Module 7.4 30 minIntermediate

Configuration as code — push, pull and plan

Each of the major configuration tools has a different philosophy: agentless vs agented, push vs pull, declarative vs imperative. You should be able to recognize each.

Course plan — preview

What you'll learn

  • Identify each tool's transport model and language.
  • Recognize a small Ansible playbook.

Comparison

Two questions sort every configuration tool. Push or pull: does a control node reach out to the devices, or does each device fetch its own configuration? Agent or agentless: must software run on every managed device, or is SSH (or an API) enough? Most network devices cannot run third-party agents, which is why agentless push dominates network automation.

ToolModelTransportLanguage
AnsiblePushSSH (agentless)YAML
PuppetPullAgent + masterPuppet DSL (Ruby-like)
ChefPullAgent + chef-serverRuby
SaltStackPush or pullZeroMQ + minionsYAML
TerraformPushProvider APIs (agentless)HCL

Ansible playbook example

Read it from the top. The three dashes start the YAML document. The play targets the routers group from the inventory and turns off fact gathering. Its two connection variables matter: ansible_connection selects network_cli, which drives the device's CLI over SSH, and ansible_network_os tells network_cli which CLI dialect to expect — without it, network_cli fails before the first task. Each task then calls the cli_config module with a line of configuration.

baseline.yml — a two-task playbook
---
- name: Baseline the routers
  hosts: routers
  gather_facts: false
  vars:
    ansible_connection: ansible.netcommon.network_cli
    ansible_network_os: netforge.nfcli.nfcli
  tasks:
    - name: Set hostname on each router
      ansible.netcommon.cli_config:
        config: "hostname {{ inventory_hostname }}"

    - name: Configure NTP
      ansible.netcommon.cli_config:
        config: ntp server 0.pool.ntp.org
Ansible's agentless SSH transport made it the de-facto network automation tool — most network engineers' first taste of automation is Ansible against a lab full of routers.

9 more sections in this chapter, plus a 4-question quiz.

Course plan

Modules 2–8 are part of the Course & Lab Pass and All-Access Max — start with a free account

You can see the title, summary, learning objectives and the opening sections. The rest of this chapter, like all of modules 2–8, comes with the Course & Lab Pass and All-Access Max. A free account opens Module 1: How Networks Work end-to-end and saves your labs — start there, no card required.

  • Read every chapter in Module 1 — How Networks Work
  • Save labs of up to 5 devices
  • Save up to 3 topologies
  • See the full course syllabus + chapter titles

Free account · no card required · compare plans any time