Learning paths › Automation › CSV inventories, logging and scheduling
CSV inventories, logging and scheduling
The operational plumbing around a script: an inventory as CSV rows read a dictionary at a time and written back in a fixed column order, real logging routed by severity instead of prints, credentials read from the environment, an email sent when a record reaches ERROR, and a function run on an interval to poll interface state — then results sorted and rendered as a text table, comprehensions, nested data copied without sharing, another program run from Python, and Netmiko waiting for the prompt and answering the questions an image copy asks. Explanation and checks; three written exercises.
Lessons
- Represent an inventory as CSV rows
- Read one device per row with its commands
- Read a header row, then the data rows
- Get a dictionary per row instead of a list
- Write mappings out in a fixed column order
- Record what a script did, not just prints
- Route records by severity threshold
- Read credentials from the environment
- Email an alert when a log hits ERROR
- Run a function on an interval
- Poll interface state on a schedule
- Number items as you loop over them
- Pull named fields out of records
- Sort in place or return a new list
- Render records as a text table
- Add colour to printed results
- Build a filtered list in one line
- Build a device-to-value mapping in one line
- Copy nested data without sharing it
- Run another program from Python
- Netmiko: platform-aware CLI sessions over SSH
- Wait for the prompt with send_command
- Push a config set and leave config mode
- Answer the prompts an image copy asks
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
- 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
- Ansible: inventory, ad-hoc commands and first playbooks
- 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