-
Notifications
You must be signed in to change notification settings - Fork 1
/
del-vrf-config.yml
73 lines (62 loc) · 1.59 KB
/
del-vrf-config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
- name: VRF configuration
hosts: csr
connection: local
gather_facts: no
vars:
vrf_name: ansible
vrf_int: loopback111
tasks:
- name: Get Login credentials
include_vars: /mnt/hgfs/vm_shared/ansible/access.yml
- name: Define Provider
set_fact:
provider:
#host: 192.168.50.105
host: "{{ access['device_ip'] }}"
username: "{{ access['username'] }}"
password: "{{ access['password'] }}"
- name: REMOVE VRF
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- no vrf definition {{ vrf_name }}
# - no rd 1:1
# - route-target export 1:1
# - route-target import 1:1
# - address-family ipv4
# - exit-address-family
parents: ['vrf definition {{ vrf_name }}']
match: exact
- name: REMOVE VRF Interface
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- no interface {{ vrf_int }}
# - no ip address 2.2.2.2 255.255.255.255
# - no vrf forwarding ansible
parents: ['interface {{ vrf_int }}']
match: exact
- name: Run 'show VRF'
ios_command:
provider: "{{ provider }}"
authorize: yes
commands:
- show vrf
register: vrf
- debug: var=vrf.stdout_lines
- name: Run 'show run VRF... '
ios_command:
provider: "{{ provider }}"
authorize: yes
commands:
- show run vrf
register: run_vrf
- debug: var=run_vrf.stdout_lines
handlers:
- name: write config
ios_command:
commands: write memory
provider: "{{ provider }}"