Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: CONFIGURE CISCO ROUTERS
- hosts: router_bdnog11
- gather_facts: no
- connection: local
- tasks:
- - name: OBTAIN LOGIN INFORMATION
- include_vars: secrets.yml
- - name: DEFINE PROVIDER
- set_fact:
- provider:
- host: "{{ ansible_host }}"
- username: "{{ creds['username'] }}"
- password: "{{ creds['password'] }}"
- auth_pass: "{{ creds['auth_pass'] }}"
- - name: BASIC CONFIGURATION
- ios_config:
- provider: "{{ provider }}"
- authorize: yes
- lines:
- - aaa new-model
- - aaa authentication login default local
- - aaa authentication enable default enable
- - no logging console
- - no ip domain-lookup
- - ipv6 unicast-routing
- - ipv6 cef
- - no ip source-route
- - no ipv6 source-route
- - snmp-server community C-DAC RO 99
- - ntp server 192.168.0.250
- - name: CONFIGURE INTERFACE SETTINGS
- ios_config:
- provider: "{{ provider }}"
- authorize: yes
- parents: interface FastEthernet2/0
- lines:
- - description Test Interface
- - ip address 172.31.1.1 255.255.255.252
- - ipv6 address 2001:db8:8::9/64
- - no shutdown
- - name: ALL-DENY PREFIX LIST
- ios_config:
- provider: "{{ provider }}"
- authorize: yes
- lines:
- - ip prefix-list ALL-DENY seq 5 deny 0.0.0.0/0 le 32
- - name: PUSH THE POLICY to DEVICE
- ios_config:
- provider: "{{ provider }}"
- authorize: yes
- src: CUSTOMER-1.txt
- - name: BGP CONFIGURATION
- ios_config:
- provider: "{{ provider }}"
- authorize: yes
- parents: router bgp 10075
- lines:
- - neighbor 172.31.1.2 remote-as 63996
- - neighbor 172.31.1.2 description TEST-BGP
- - neighbor 172.31.1.2 activate
- - neighbor 172.31.1.2 prefix-list AS63996-Prefix in
- - neighbor 172.31.1.2 prefix-list ALL-DENY out
- - name: SAVE CONFIGURATION TO NVRAM
- ios_config:
- provider: "{{ provider }}"
- authorize: yes
- save_when: always
- register: output
- - name: SHOW RUN COMMAND
- ios_command:
- provider: "{{ provider }}"
- authorize: yes
- commands: show run
- register: print_output
- - name: SAVE OUTPUT TO A FILE
- copy: content="{{print_output.stdout[0]}}" dest="/home/gns3/inventory/backup-configuration/{{inventory_hostname}}.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement