This file contains hidden or 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
service timestamps debug datetime msec localtime show-timezone | |
service timestamps log datetime msec localtime show-timezone | |
! | |
hostname {{item.hostname}} | |
! | |
logging buffered 32000 | |
no logging console | |
enable secret 0 {{item.secret}} | |
! | |
! |
This file contains hidden or 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
service timestamps debug datetime msec localtime show-timezone | |
service timestamps log datetime msec localtime show-timezone | |
! | |
hostname {{item.hostname}} | |
! | |
logging buffered 32000 | |
no logging console | |
enable secret 0 {{item.secret}} | |
! | |
! |
This file contains hidden or 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
--- | |
switches: | |
- {hostname: pynet_sw1, secret: test, access_vlan: 20, ip_addr: 1.1.1.10, default_gateway: 1.1.1.1, snmp_community: test123, SNMP: False} | |
- {hostname: pynet_sw2, secret: test, access_vlan: 20, ip_addr: 1.1.2.10, default_gateway: 1.1.2.1, snmp_community: test123, SNMP: False} | |
- {hostname: pynet_sw3, secret: test, access_vlan: 20, ip_addr: 1.1.3.10, default_gateway: 1.1.3.1, snmp_community: test123, SNMP: True} | |
- {hostname: pynet-sw4, secret: test, access_vlan: 20, ip_addr: 1.1.4.10, default_gateway: 1.1.4.1, snmp_community: test123, SNMP: True} | |
- {hostname: pynet-sw5, secret: test, access_vlan: 20, ip_addr: 1.1.5.10, default_gateway: 1.1.5.1, snmp_community: test123, SNMP: True} |
This file contains hidden or 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
--- | |
- name: Generate configuration files | |
template: src=access_switch2.j2 dest=/home/toddr/ANSIBLE/roles/access_switch/CFGS/{{item.hostname}}2.txt | |
with_items: switches |
This file contains hidden or 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
service timestamps debug datetime msec localtime show-timezone | |
service timestamps log datetime msec localtime show-timezone | |
! | |
hostname {{item.hostname}} | |
! | |
logging buffered 32000 | |
no logging console | |
enable secret 0 {{item.secret}} | |
! |
This file contains hidden or 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
--- | |
switches: | |
- {hostname: pynet_sw1, secret: test, access_vlan: 20, ip_addr: 1.1.1.10, default_gateway: 1.1.1.1, snmp_community: test123} | |
- {hostname: pynet_sw2, secret: test, access_vlan: 20, ip_addr: 1.1.2.10, default_gateway: 1.1.2.1, snmp_community: test123} | |
- {hostname: pynet_sw3, secret: test, access_vlan: 20, ip_addr: 1.1.3.10, default_gateway: 1.1.3.1, snmp_community: test123} | |
- {hostname: pynet-sw4, secret: test, access_vlan: 20, ip_addr: 1.1.4.10, default_gateway: 1.1.4.1, snmp_community: test123} | |
- {hostname: pynet-sw5, secret: test, access_vlan: 20, ip_addr: 1.1.5.10, default_gateway: 1.1.5.1, snmp_community: test123} | |
This file contains hidden or 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
--- | |
- name: Generate configuration files | |
template: src=access_switch.j2 dest=/home/toddr/ANSIBLE/roles/access_switch/CFGS/{{item.hostname}}.txt | |
with_items: switches |
This file contains hidden or 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
--- | |
- name: Generate config files | |
hosts: local | |
roles: | |
- access_switch |
This file contains hidden or 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
# Applied Python | |
# Class 2 exercise 1 | |
# | |
import snmp_helper | |
import time | |
IP = '#.#.#.#' | |
a_user = '####' |
This file contains hidden or 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
#!/usr/bin/env python | |
import snmp_helper | |
COMMUNITY_STRING = '***' | |
IP = '*.*.*.*' | |
pynet_rtr1 = (IP, COMMUNITY_STRING, ****) | |
pynet_rtr2 = (IP, COMMUNITY_STRING, ****) | |
sys_descr = '1.3.6.1.2.1.1.1.0' |
NewerOlder