FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
hardware:cisco:index.html [2018/02/05 01:08] kurihara created |
hardware:cisco:index.html [2018/02/22 23:30] (current) kurihara |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| [[: | [[: | ||
| - | ====== Cisco (cisco.py)===== | + | ====== Cisco Configuration with Fabric |
| $FHHOME/ | $FHHOME/ | ||
| Line 6: | Line 6: | ||
| {{INLINETOC}} | {{INLINETOC}} | ||
| \\ | \\ | ||
| - | + | I use Fabric for simple tasks and repetitive tasks. | |
| - | ===== Operation ===== | + | \\ |
| + | ===== Fabric | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| Line 14: | Line 15: | ||
| </ | </ | ||
| - | ==== Ref. Remote Shell Commands | + | \\ |
| + | ==== How to Check to Use Fabric in Cisco ==== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ echo xx.xx.xx.xx | + | $ ssh user01@xx.xx.xx.xx |
| </ | </ | ||
| + | |||
| + | |||
| + | /* | ||
| + | ==== Fabric Remote Shell Commands ==== | ||
| + | <sxh bash toolbar: | ||
| + | $ fab -H $HOST auth.ciscopro --set shell=False --no-pty -- show interfaces status | ||
| + | </ | ||
| + | */ | ||
| + | |||
| \\ | \\ | ||
| - | ===== netapp.py ===== | + | ===== cisco.py ===== |
| - | $FHHOME/ | + | $FHHOME/ |
| <sxh python toolbar: | <sxh python toolbar: | ||
| Line 29: | Line 40: | ||
| from fabric.contrib import files | from fabric.contrib import files | ||
| + | env.eagerly_disconnect = False | ||
| FHHOME=os.environ[" | FHHOME=os.environ[" | ||
| + | |||
| # | # | ||
| Line 37: | Line 50: | ||
| # cisco.enable | # cisco.enable | ||
| # | # | ||
| - | @task(alias=" | + | @task |
| def enable(): | def enable(): | ||
| try: | try: | ||
| Line 45: | Line 58: | ||
| # | # | ||
| - | #cisco.termleng0 | + | #cisco.term_leng0 |
| # | # | ||
| @task | @task | ||
| Line 54: | Line 67: | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | @task | ||
| + | def sh_run(): | ||
| + | """ | ||
| + | run(" | ||
| + | |||
| + | # | ||
| + | # | ||
| + | # | ||
| + | @task | ||
| + | def sh_int_status(): | ||
| + | """ | ||
| + | run(" | ||
| </ | </ | ||
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.