-
Notifications
You must be signed in to change notification settings - Fork 0
/
preso.htm
248 lines (200 loc) · 7.21 KB
/
preso.htm
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Automating the network</title>
<link rel="stylesheet" href="source/reveal.css">
<link rel="stylesheet" href="source/theme/night.css">
<link rel="stylesheet" href="source/oli.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.3.0/lib/css/zenburn.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section id="Title">
<h1 style="color:orange;">Automating the network</h1>
<h3>Aka The Network as Code</h3>
<p>
<strong style="color:rgba(0, 217, 255, 0.603);">Oliver Elliott</strong>
</p>
</section>
<section>
<section id="Quote">
<p>"I am rarely happier than when spending an entire day programming my computer to perform automatically a task that would otherwise take me a good ten seconds to do by hand."</p>
<p align="right"><small>Douglas Adams</small></p>
</section>
<section id="In the olden days">
<h3>In the <strong>olden</strong> days</h3>
<img height="600px" src="images/typing_pool.jpg">
<h5>A Network team, circa 2005</h5>
<ul>
<li class="fragment" style="color:orange;">Lots of manual, repetitive work</li>
<li class="fragment" style="color:orange;">Having to memorise the specific workflow of each possible configuration</li>
<li class="fragment" style="color:orange;">Bad: Typos mean you have to redo something</li>
<li class="fragment" style="color:red;">Worse: Typos causing outages!</li>
</ul>
</section>
</section>
<section>
<section id="Scripting">
<img src="images/matrix.gif" ></br>
</section>
<section id="TheGoodStuff">
<h3>Good vs Bad</h3>
<ul>
<li class="fragment" style="color:green;">Replaces repeatable tasks</li>
<li class="fragment" style="color:green;">Highly customisible</li>
<li class="fragment" style="color:red;">Difficult to maintain</li>
<li class="fragment" style="color:red;">Knowledge of how they work tends to sit with the author</li>
</ul>
</section>
</section>
<section>
<section id="Why Ansible">
<img src="images/ansible.jpg" ></br>
</section>
<section>
<h2>Why Orchestration?</h2>
<ul>
<li class="fragment">One place to manage all of the automation</li>
<li class="fragment">Allows for intra and inter team collaboration</li>
<li class="fragment">Relatively easy to manage workflow using gitlab</li>
</ul>
</section>
<section>
<h2>Why Ansible?</h2>
<p style="color:red;">Switches are dumb</p>
<p><span class="fragment">What about <strong style="color:teal;">Puppet</strong><span class="fragment">, or <strong style="color:purple;">Chef</strong><span class="fragment">, or <strong style="color:maroon;">Salt?</strong></p>
<ul class="fragment">
<li>Easy to install and run, simple 'pip install'</li>
<li>Easy to upgrade, no agents to worry about</li>
<li>(Relatively) easy to read playbooks</li>
<li>Good network vendor support: Cisco, Juniper, F5 etc.</li>
</ul>
</section>
</section>
<section>
<section id="How does Ansible work?">
<h2 style="color:orange;">How does Ansible work?</h2>
<p>Connects to a target host</p>
<p>Runs YAML playbooks</p>
</section>
<section>
<p style="color:orange;">For servers:</p>
<p>Ansible works by connecting to a server using SSH (or WS-Man/WinRM for Windows), copies the Python code over, executes it and then removes itself.</p><br>
<p style="color:orange;">For switches:</p>
<p>Python code is run locally, which in turn uses the python module paramiko to connect to the switch</p>
</section>
<section>
<h2 style="color:orange;">Examples of playbooks</h2>
</section>
<section>
<h3 style="color:orange;">Add a user to a switch</h3>
<pre><code class="YAML">
---
- name: Add a user
hosts: all
gather_facts: no
roles:
- cisco-ios-passwords
vars:
username: "a_user"
secret: "super_secret_password"
tasks:
- name: Add User
ios_config:
lines:
- "username {{ username }} privilege 15 secret 5 {{ secret }}"
register: ios_user_add
when: ansible_network_os == "ios"
- name: Save config
ios_command:
commands:
- wr
when: ios_user_add.changed
</code></pre>
</section>
<section>
<h3 style="color:orange;">Label interfaces</h3>
<pre><code class="YAML">
---
- name: Int Label
hosts: all
connection: local
gather_facts: no
roles:
- access_switch
- cisco-ios-passwords
vars:
creds:
username: "{{ user }}"
password: "{{ password }}"
host: "{{ inventory_hostname }}"
# High timeout required for 3850s
timeout: 40
tasks:
- name: Get cdp neighbours using NTC
ntc_show_command:
command: "show cdp neighbor detail"
provider: "{{ creds }}"
connection: ssh
platform: "cisco_ios"
template_dir: "/home/oe0745/git/ntc-templates/templates/"
register: cdp_neighbors
check_mode: no
- name: Get interface descriptions
ntc_show_command:
command: "show interface status"
provider: "{{ creds }}"
connection: ssh
platform: "cisco_ios"
template_dir: "/home/oe0745/git/ntc-templates/templates/"
register: int_status
check_mode: no
- name: Change descriptions where required
ios_interface:
name: "{{ item.key }}"
description: "{{ item.value }}"
with_dict: "{{ cdp_neighbors | int_label(int_status) }}"
register: descs
- name: Save config
ios_command:
commands:
- wr
when: descs.changed
</code></pre>
</section>
<!-- <section>
<h2>Live Demo!</h2>
<p class="fragment" style="color:red;">oh no</p>
</section> -->
</section>
<section>
<h2 style="color:orange;">Questions?</h2>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
width: 1920,
height: 1080,
controls: true,
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true },
]
});
</script>
</body>
</html>