Learning paths › Automation › Loops, callbacks, strategy and run control
Loops, callbacks, strategy and run control
How a run behaves rather than what it configures: callbacks hooked into play and task events with results sent to a chat channel, a task looped once per item or retried until its condition holds, work restricted by condition, host, tag or limit, the strategy and fork count that stop fast hosts waiting on a slow one, a change predicted without being applied, a task delegated elsewhere or run once — then honest reporting, with failure defined deliberately, change reported truthfully for a read-only command, credentials kept out of logs, a save only when config changed, and a block that recovers through its rescue. Explanation and checks; six written exercises.
Lessons
- Run a shell command on the controller
- Hook into play and task events
- Send run results to a Slack channel
- Run one task once per list item
- Retry a task until its condition holds
- Run a task only on matching devices
- Stop fast hosts waiting on a slow one
- Set how many devices are worked in parallel
- Inspect and retry a failing task interactively
- Control the order hosts are processed in
- Write run output to a controller log file
- Select or skip parts of a playbook
- Restrict a run to certain hosts
- Predict a change without applying it
- Run a task on a different device
- Gather shared reference data only once
- Continue after a task returns failure
- Define what counts as a failure
- Report change honestly for read-only commands
- Keep credentials out of logs and output
- Save and back up only when config changed
- Group tasks and recover from a failure
- Check prerequisites before you change anything
- Install and reference content by namespace
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
- 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
- Roles, imports and writing your own module
- Running playbooks from AWX