Learning paths › Automation › Jinja filters and PAN-OS automation
Jinja filters and PAN-OS automation
Jinja and regular expressions inside a playbook, taught against a firewall: encrypted credentials kept in host_vars, address objects and groups read, filtered by name or description and created, a group built from gathered object names, a security rule composed from zones and addresses, and the candidate committed only when something changed — then the templating itself, a first match and then every match with its capture groups, matched text rewritten, config rendered with expressions and loops and composed from smaller files, Jinja placed directly in a task argument, and a variable name resolved at runtime. Explanation and checks; four written exercises.
Lessons
- Split a URL into its components
- Join and split strings on a chosen delimiter
- Format a timestamp for filenames and reports
- Install the panos collection and its dependencies
- Keep encrypted firewall credentials in host_vars
- Read firewall address objects into a variable
- Filter gathered objects by name or description
- Read address groups and their members
- Commit the candidate config only when something changed
- Create a security rule from zones and addresses
- Create and update an address object by name
- Build a group from gathered object names
- Find the first match in command output
- Collect every match and its capture groups
- Rewrite matched text into a new string
- Render config text with expressions and loops
- Apply a rendered template to an IOS device
- Emit one route line per destination pair
- Compose a device template from smaller files
- Put Jinja expressions in task arguments
- Read a controller-side file into a variable
- Render a template straight into an argument
- Resolve a variable name built at runtime
- Read the controller's environment variables
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
- Loops, callbacks, strategy and run control
- Roles, imports and writing your own module
- Running playbooks from AWX