-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from jeffkala/jkala-fix64
force the enable call to allow many cisco ios platforms to work
- Loading branch information
Showing
4 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Example with a actual dispatcher task.""" | ||
|
||
import logging | ||
import os | ||
from nornir import InitNornir | ||
from nornir_utils.plugins.functions import print_result | ||
from nornir_nautobot.plugins.tasks.dispatcher import dispatcher | ||
|
||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
my_nornir = InitNornir( | ||
inventory={ | ||
"plugin": "NautobotInventory", | ||
"options": { | ||
"nautobot_url": "http://localhost:8080/", | ||
"nautobot_token": "0123456789abcdef0123456789abcdef01234567", | ||
"filter_parameters": {"location": "Site 1"}, | ||
"ssl_verify": False, | ||
}, | ||
}, | ||
) | ||
my_nornir.inventory.defaults.username = os.getenv("NORNIR_USERNAME") | ||
my_nornir.inventory.defaults.password = os.getenv("NORNIR_PASSWORD") | ||
|
||
for nr_host, nr_obj in my_nornir.inventory.hosts.items(): | ||
network_driver = my_nornir.inventory.hosts[nr_host].platform | ||
result = my_nornir.run( | ||
task=dispatcher, | ||
logger=LOGGER, | ||
method="get_config", | ||
obj=nr_host, | ||
framework="netmiko", | ||
backup_file="./ios.cfg", | ||
remove_lines=None, | ||
substitute_lines=None, | ||
) | ||
print_result(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters