-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprovision_random_loopbacks.yml
94 lines (87 loc) · 2.49 KB
/
provision_random_loopbacks.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
---
#
# Playbook to Provision Random Traffic Jam Loopbacks for Devnet Create Sandbox
# Written by: Nick Thompson (@nsthompson)
# Copyright (C) 2020 World Wide Technology
# All Rights Reserved
#
# Usage:
# -- Provision First Pass of Random Loopback Interfaces
# ansible-playbook -i inventory provision_random_loopbacks.yml --tags="first"
# -- Provision Second Pass of Random Loopback Interfaces
# ansible-playbook -i inventory provision_random_loopbacks.yml --tags="second"
#
- hosts: trafficjam
connection: local
collections:
- wwt.trafficjam
tasks:
- name: Load Variables
include_vars:
file: ips.yml
tags:
- always
- name: Provision VRF_A Loopback Interfaces
trafficjam_dummy_interfaces:
host: "{{ ansible_host }}"
state: present
config:
name: "Random_A.{{ my_idx_a }}"
description: "VRF_A Loopback"
vrf_id: 6
v4_address: "{{ item }}"
loop: "{{ (random_A_addresses | shuffle)[0:5] }}"
loop_control:
pause: 2
index_var: my_idx_a
ignore_errors: true
tags:
- first
- name: Provision VRF_B Loopback Interfaces
trafficjam_dummy_interfaces:
host: "{{ ansible_host }}"
state: present
config:
name: "Random_B.{{ my_idx_b }}"
description: "VRF_B Loopback"
vrf_id: 7
v4_address: "{{ item }}"
loop: "{{ (random_B_addresses | shuffle)[0:5] }}"
loop_control:
pause: 2
index_var: my_idx_b
ignore_errors: true
tags:
- first
- name: Provision VRF_A Loopback Interfaces
trafficjam_dummy_interfaces:
host: "{{ ansible_host }}"
state: present
config:
name: "Random_A2.{{ my_idx_a2 }}"
description: "VRF_A Loopback"
vrf_id: 6
v4_address: "{{ item }}"
loop: "{{ (random_A2_addresses | shuffle)[0:5] }}"
loop_control:
pause: 2
index_var: my_idx_a2
ignore_errors: true
tags:
- second
- name: Provision VRF_B Loopback Interfaces
trafficjam_dummy_interfaces:
host: "{{ ansible_host }}"
state: present
config:
name: "Random_B2.{{ my_idx_b2 }}"
description: "VRF_B Loopback"
vrf_id: 7
v4_address: "{{ item }}"
loop: "{{ (random_B2_addresses | shuffle)[0:5] }}"
loop_control:
pause: 2
index_var: my_idx_b2
ignore_errors: true
tags:
- second