-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmultivendor-netconfig.yml
93 lines (78 loc) · 3.14 KB
/
multivendor-netconfig.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
---
- name: Setup management Cisco IOSXE router config
hosts: routers
gather_facts: no
vars_files:
- if_var.yml
- ntp_var.yml
- banner_vars.yml
tasks:
- name: Gather IOSXE router facts
cisco.ios.facts:
when: ('ios' in ansible_network_os)
- name: Gather EOS router facts
arista.eos.facts:
when: ('eos' in ansible_network_os)
- name: Display OS version
debug:
msg: "The OS version is: {{ ansible_net_version }}"
- name: Configure Loopback interface IOSXE
ios_l3_interfaces:
config: "{{l3_interface}}"
when: ('ios' in ansible_network_os)
- name: Configure Loopback interface EOS
eos_l3_interfaces:
config: "{{l3_interface}}"
when: ('eos' in ansible_network_os)
- name: Load IOS system properties onto device
ios_system:
domain_name: "{{network_domain_name | default(omit, True) }}"
domain_search: "{{network_domain_search | default(omit, True)}}"
hostname: "{{network_hostname | default(omit, True)}}"
lookup_source: "{{network_lookup_source | default(omit, True) }}"
name_servers: "{{network_name_servers | default(omit, True) }}"
when: ('ios' in ansible_network_os)
- name: Load EOS system properties onto device
eos_system:
domain_name: "{{network_domain_name | default(omit, True) }}"
domain_search: "{{network_domain_search | default(omit, True)}}"
hostname: "{{network_hostname | default(omit, True)}}"
lookup_source: "{{network_lookup_source | default(omit, True) }}"
name_servers: "{{network_name_servers | default(omit, True) }}"
when: ('eos' in ansible_network_os)
- assert:
that:
- "ntp_server | ipaddr"
msg: "'ntp_server' must be a valid IPv4 address"
- name: Configure NTP IOSXE
ios_config:
lines: "ntp server {{ntp_server}}"
when: ('ios' in ansible_network_os)
- name: Configure NTP EOS
eos_config:
lines: "ntp server {{ntp_server}}"
when: ('eos' in ansible_network_os)
- name: Configure management user IOSXE
ios_user:
name: "{{network_name | default(omit, True) }}"
ssh_key: "{{network_key | default(omit, True) }}"
privilege: "{{network_privilege | default(omit, True) }}"
configured_password: "{{network_configured_password | default(omit, True) }}"
when: ('ios' in ansible_network_os)
- name: Configure management user EOS
eos_user:
name: "{{network_name | default(omit, True) }}"
ssh_key: "{{network_key | default(omit, True) }}"
privilege: "{{network_privilege | default(omit, True) }}"
configured_password: "{{network_configured_password | default(omit, True) }}"
when: ('eos' in ansible_network_os)
- name: Add banner IOSXE
ios_banner:
text: "{{ network_banner }}"
banner: "{{ banner_type }}"
when: ('ios' in ansible_network_os)
- name: Add banner EOS
eos_banner:
text: "{{ network_banner }}"
banner: "{{ banner_type }}"
when: ('eos' in ansible_network_os)