Created
July 17, 2020 01:16
-
-
Save nshores/1688f241828aba5d5e26637767ccf742 to your computer and use it in GitHub Desktop.
ios_changes.yaml
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
#Playbook to backup configurations from IOS Devices, then apply a set of changes. | |
#Nick Shores 1-9-2017 - Created for Roebbelen Network | |
--- | |
- hosts: roebbelen | |
gather_facts: no | |
connection: local | |
vars: | |
backup_root: /tmp/backups | |
cli: | |
host: "{{ inventory_hostname }}" | |
username: "{{ ansible_user }}" | |
password: "{{ ansible_password }}" | |
transport: cli | |
tasks: | |
- name: Backup Config | |
ios_config: | |
backup: yes | |
provider: "{{ cli }}" | |
- name: Config Trust port uplink | |
ios_config: | |
lines: | |
- ip dhcp snooping trust | |
parents: interface gi1/1 | |
provider: "{{ cli }}" | |
- name: Config Trust port uplink on 10.1.1.245 | |
ios_config: | |
lines: | |
- ip dhcp snooping trust | |
parents: interface gi0/48 | |
provider: "{{ cli }}" | |
when: "'10.1.1.245' in inventory_hostname" | |
- name: Enable DHCP Snooping on VLAN's | |
ios_config: | |
lines: | |
- ip dhcp snooping vlan 1000,2000,1 | |
provider: "{{ cli }}" | |
- name: Update DHCP Snooping Globally | |
ios_config: | |
lines: | |
- ip dhcp snooping | |
provider: "{{ cli }}" | |
- name: Verify Changes | |
ios_command: | |
commands: | |
- show ip dhcp snooping | include Switch | |
provider: "{{ cli }}" | |
register: result | |
- name: debug | |
debug: | |
var: result.stdout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment