Skip to content

Instantly share code, notes, and snippets.

@nshores
Created July 17, 2020 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nshores/1688f241828aba5d5e26637767ccf742 to your computer and use it in GitHub Desktop.
Save nshores/1688f241828aba5d5e26637767ccf742 to your computer and use it in GitHub Desktop.
ios_changes.yaml
#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