-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheigrp_configuration.yml
97 lines (86 loc) · 2.88 KB
/
eigrp_configuration.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
- name: IPv4 EIGRP configuration
hosts: R3,MLS1
connection: local
gather_facts: no
tags: ipv4
vars:
templates_folder: 'templates/{{ vendor }}/{{ dev_type }}'
staging_eigrp_folder: 'files/staging/eigrp'
parsed_eigrp_configuration_file: '{{ staging_eigrp_folder }}/{{ inventory_hostname }}.conf'
commit_config: true
tasks:
- block:
- name: Create folders for parsed eigrp configuration
file:
path: "{{ staging_eigrp_folder }}"
state: directory
check_mode: no
- name: Set no conf commit variable (enable testing mode)
set_fact:
commit_config: false
when: ansible_check_mode
- name: Parse eigrp_ipv4 template
template:
src: '{{ templates_folder }}/eigrp_ipv4.j2'
dest: '{{ parsed_eigrp_configuration_file }}'
check_mode: no
- name: Load and commit configuration
napalm_install_config:
provider: "{{ napalm_provider }}"
config_file: '{{ parsed_eigrp_configuration_file }}'
replace_config: false
commit_changes: "{{ commit_config }}"
register: result
- name: Clean temporary folders/files
file:
state: absent
path: "{{ staging_eigrp_folder }}"
check_mode: no
run_once: true
- name: Print differences in configs
debug:
msg: "{{ result | to_nice_yaml }}"
when: eigrp_config is defined
- name: IPv6 EIGRP configuration
hosts: R3,MLS1
connection: local
gather_facts: no
tags: ipv6
vars:
templates_folder: 'templates/{{ vendor }}/{{ dev_type }}'
staging_eigrp_folder: 'files/staging/eigrp'
parsed_eigrp_configuration_file: '{{ staging_eigrp_folder }}/{{ inventory_hostname }}.conf'
commit_config: true
tasks:
- block:
- name: Create folders for parsed eigrp configuration
file:
path: "{{ staging_eigrp_folder }}"
state: directory
check_mode: no
- name: Set no conf commit variable (enable testing mode)
set_fact:
commit_config: false
when: ansible_check_mode
- name: Parse eigrp_ipv6 template
template:
src: '{{ templates_folder }}/eigrp_ipv6.j2'
dest: '{{ parsed_eigrp_configuration_file }}'
check_mode: no
- name: Load and commit configuration
napalm_install_config:
provider: "{{ napalm_provider }}"
config_file: '{{ parsed_eigrp_configuration_file }}'
replace_config: false
commit_changes: "{{ commit_config }}"
register: result
- name: Clean temporary folders/files
file:
state: absent
path: "{{ staging_eigrp_folder }}"
check_mode: no
run_once: true
- name: Print differences in configs
debug:
msg: "{{ result | to_nice_yaml }}"
when: eigrp_ipv6_config is defined