Learning paths › Automation › Paramiko: SSH to devices from Python
Paramiko: SSH to devices from Python
Paramiko put to work: a prompted password instead of a hardcoded one, OSPF configured across a list of routers, a Linux shell driven interactively while exec_command keeps stdout and stderr apart, the repeated SSH logic moved into a module that does not connect when imported, a config backup written per device, device waits overlapped on a thread pool, and files moved with SCP — after which Netmiko takes over prompt and paging handling and pushes a reviewed config file. Explanation and checks; two written exercises.
Lessons
- Prompt for the password instead of hardcoding it
- Configure OSPF across a list of routers
- Drive a Linux shell like a human terminal
- Use exec_command for separate stdout and stderr
- Create a Linux account through sudo
- Move repeated SSH logic into your own module
- Collect show output through your wrapper
- Stop import from connecting to a router
- Capture one device's config to a named file
- Back up every device in the inventory
- Overlap device waits with a thread pool
- Assignment: create a Linux account interactively
- Validate input and check the remote exit status
- Move files over SSH with SCP
- Work sixteen Paramiko challenges
- Confirm the lab is ready for Netmiko
- Netmiko: let a driver handle prompts and paging
- Pick the device_type that matches the platform
- Move between EXEC and config modes
- Send a set of config commands at once
- Push a reviewed config file to a device
- Bind each device to its own config file
- Write one backup artifact per device
- Measure how long a sequential run takes
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
- 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
- Loops, callbacks, strategy and run control
- Roles, imports and writing your own module
- Running playbooks from AWX