Learning paths › Automation › Ansible: inventory, ad-hoc commands and first playbooks
Ansible: inventory, ad-hoc commands and first playbooks
Ansible from the inventory up: an SSH path to the router, an Ansible inventory told apart from /etc/hosts, ansible.cfg kept beside the project it serves, ad-hoc commands run against one switch, a group or everything, and output captured locally one file per device before the pattern is generalised to any show command — then the same work written as a playbook and turned toward changing things, with an OSPF network statement placed under its parent, routers and switches given separate plays, a nested policy configured, and port records looped instead of repeated. Explanation and checks; five written exercises.
Lessons
- Give Ansible an SSH path to the router
- Tell /etc/hosts apart from an Ansible inventory
- Keep ansible.cfg beside the project it serves
- Run a task without writing a playbook
- Pick one switch, a group, or everything
- Swap the command without touching the inventory
- Capture command output into a local file
- Collect ARP and MAC tables from several switches
- Generalise the pattern to any show command
- Write your first playbook to collect ARP data
- Change what a playbook collects, not its shape
- Use ios_command instead of a raw CLI task
- Name each output file after its device
- Pull the running config with enough privilege
- Move from reading devices to configuring them
- Add an OSPF network statement under its parent
- Target a group instead of listing devices
- Give routers and switches separate plays
- Apply global settings to every access switch
- Configure a nested policy with parent commands
- Loop over port records instead of repeating tasks
- Add a second play for the core switches
- Compare agent-based and agentless automation
- Treat network intent as code in files
More in Automation
- First scripts that configure devices
- NAPALM: structured data across vendors
- Concurrency, and the Python types device output returns
- Parsing show output and testing conditions
- Readable code, branching and loops
- Build the workstation and the toolchain
- Files, CSV, JSON and pickle
- Paramiko: SSH to devices from Python
- Netmiko at fleet scale
- Tuples, sets and dictionaries for device records
- Exceptions and your first classes
- Plan and build the automation lab
- Files, formatting and regular expressions
- Addresses, functions, modules and classes
- CSV inventories, logging and scheduling
- Netmiko, SCP and structured parsing
- Agents, async and model-driven workflows
- NETCONF, YANG and RESTCONF
- NX-API, pyATS and Genie
- A small GenAI app, end to end
- macOS, Linux and the virtual lab
- Agile delivery and Python fundamentals
- REST APIs, authentication and requests
- Flask, Docker and Jenkins
- Managing a router with NETCONF and RESTCONF
- Roles and zero-touch provisioning for Linux switches
- Installing the controller and applying a project
- Setting up Python 3
- The Ansible lab and the controller
- Vault, variables and config changes
- Parsing output and knowing which variable wins
- Jinja filters and PAN-OS automation
- Loops, callbacks, strategy and run control
- Roles, imports and writing your own module
- Running playbooks from AWX