-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2019-renewed-ansible-v-puppet.html
717 lines (594 loc) · 20 KB
/
2019-renewed-ansible-v-puppet.html
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Is that an Ansible? Stop Using It Like a Puppet - OSCamp 2019 - Felix Frank</title>
<meta name="description" content="Slides for the Ansible vs. Puppet presentation">
<meta name="author" content="Felix Frank">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/white-light-code.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="lib/css/tomorrow.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<style>
/* override theme */
.reveal section img { border: 0px; }
.reveal img.plain { box-shadow: none }
.reveal a { color: black; }
/* custom classes */
p.source { font-size: small; text-align: right }
p.large { font-size: 200% }
p.smaller { font-size: 75%; }
div.title { position: absolute; top: 50px }
span.odd { color: #8a8a8a; }
</style>
<div class="reveal">
<div class="slides">
<section>
<h2>Is that an Ansible?</h2>
<h3>Stop holding it like a Puppet.</h3>
<p>OSCamp 2019, Berlin</p>
<p class="smaller" style="margin-top: 2em;">
Felix Frank, Systems Architect<br/>
The unbelievable Machine Company GmbH
</p>
</section>
<section>
<h3 style="text-align: left;">What? Who now?</h3>
<p>Felix (probably not literally a cat)</p>
<ul>
<li>old command line geezer</li>
<li>open source vagabond</li>
<li>config management nerd</li>
<li>would've come here by bicycle</li>
</ul>
</section>
<section><p class="large">A text</p></section>
<section>
The pig go.
<span class="odd">
Go is to the fountain.
</span>
The pig put foot. Grunt.
<span class="odd">
Foot in what? ketchup.
</span>
The dove fly.
<span class="odd">
Fly is in sky.
</span>
The dove drop something.
<span class="odd">
The something on the pig.
</span>
The pig disgusting.
<span class="odd">
The pig rattle.
</span>
Rattle with dove.
<span class="odd">
The dove angry.
</span>
The pig leave.
<span class="odd">
The dove produce.
</span>
Produce is chicken wing.
<span class="odd">
With wing bark.
</span>
No Quack.
</section>
<section><p class="large">Guess the author?</p></section>
<section>
<section>
<p class="large">The story goes as follows.</p>
</section>
<section><img src="noquack1.png"/></section>
<section><img src="noquack2.png"/></section>
<section><img src="noquack3.png"/></section>
<section><img src="noquack4.png"/></section>
<section><img src="noquack5.png"/></section>
<section><img src="noquack6.png"/></section>
<section><img src="noquack7.png"/></section>
<section><img src="noquack8.png"/></section>
<section><img src="noquack9.png"/></section>
<section><img src="noquack10.png"/></section>
<section><img src="noquack11.png"/></section>
<section><img src="noquack12.png"/></section>
<section><img src="noquack13.png"/></section>
<section><img src="noquack14.png"/></section>
<section>
<p>Don't use blatantly wrong tools.</p>
</section>
</section>
<section>
<p class="large">When all you have<br/>
is a hammer,<br/>
everything looks like a nail</p>
</section>
<section><h1>No quack.</h1></section>
<section>
<p class="large">Welcome to Ansible session 2</p>
</section>
<section>
<img src="puppet-ansible.png"/>
</section>
<section>
<div class="title">Benefits of config management</div>
<section>
<img src="wiki-doc.png"/>
<p>No manual tinkering.
No wiki install guides.</p>
</section>
<section>
<p class="large">Repeatable setup</p>
</section>
<section>
<img src="infra-code-tools.png"/>
<p>Infrastructure as Code</p>
</section>
</section>
<section>
<p class=large>Let's model a webserver</p>
</section>
<section>
<div class="title">In Puppet</div>
<section>
<img src="ws-puppet-01.svg"/>
</section>
<section>
<img src="ws-puppet-02.svg"/>
</section>
<section>
<img src="ws-puppet-03.svg"/>
</section>
<section>
<img src="ws-puppet-04.svg"/>
</section>
</section>
<section>
<p class=large>Ansible: Similar but different</p>
</section>
<section>
<div class="title">In Ansible</div>
<section>
<img src="ws-ansible-01.svg"/>
</section>
<section>
<img src="ws-ansible-02.svg"/>
</section>
<section>
<img src="ws-ansible-03.svg"/>
</section>
</section>
<section>
<div class="title">Architecture: Puppet</div>
<section>
<img src="puppet-arch.svg"/>
</section>
</section>
<section>
<div class="title">Architecture: Ansible</div>
<section>
<img src="ansible-arch.svg"/>
</section>
</section>
<section>
<div class="title">Naming Things is Hard</div>
<section>
<table>
<tr><th>Puppet</th><th>Ansible</th></tr>
<tr><td style="padding-right: 3em">resource type</td><td>module</td></tr>
<tr><td>module</td><td>role</td></tr>
<tr><td>role</td><td>group (more or less)</td></tr>
<tr><td>resource</td><td>task</td></tr>
</table>
</section>
</section>
<section>
<div class="title">Working with: Puppet</div>
<section>
<p>Editing code and data</p>
<ul>
<li>Puppet manifests</li>
<li>Hiera data stores</li>
</ul>
</section>
<section>
<pre><code>class nodejs::install {
$npmrc_auth = $::nodejs::npmrc_auth
if $caller_module_name != $module_name {
fail("Use of private class ${name} by ${caller_module_name}")
}
# npm is a Gentoo USE flag
if $::operatingsystem == 'Gentoo' {
package_use { $nodejs::nodejs_package_name:
ensure => present,
target => 'nodejs-flags',
use => $nodejs::use_flags,
before => Package[$nodejs::nodejs_package_name],
}
}
# nodejs
package { $nodejs::nodejs_package_name:
ensure => $nodejs::nodejs_package_ensure,
tag => 'nodesource_repo',
}
</code></pre>
</section>
<section>
<pre><code>---
nodejs::npm_path: /opt/osdc/npm/bin/npm
nodejs::manage_package_repo: false
nodejs::repo_proxy: "10.17.81.121"
nodejs::repo_proxy_username: sys
nodejs::repo_proxy_password: o0psThisisS3cre3t
apache::default_vhost: stage_site
apache::user: fitz
</code></pre>
</section>
<section>
<img src="forge.png"/>
<p>Modules are available from the Puppet Forge</p>
</section>
<section>
<img src="roles-profiles.svg"/>
<p>Custom code organized into Roles and Profiles</p>
</section>
<section>
<img src="foreman.png"/>
<p class="source">http://projects.theforeman.org/projects/foreman/wiki/Screenshots</p>
<p>Optionally use ENCs like the Foreman</p>
</section>
<section>
<img src="unicorn.png" style="width: 25%"/>
<p class="source">http://maxpixel.freegreatpicture.com/Dream-Space-Sky-Galaxy-Magic-Unicorn-Fantasy-2035174</p>
<p>orchestration through MCollective</p>
</section>
<section>
<img src="puppetboard.png"/>
<p>visualization with e.g. PuppetBoard</p>
</section>
</section>
<section>
<img src="drowzy.jpg"/>
<p class="source">http://www.dailymail.co.uk/news/article-3152277/Dog-tor-Doolittle-Pet-pooch-friends-animals-loves-snuggling-hamster-bird-pals.html</p>
</section>
<section>
<div class="title">Working with: Ansible</div>
<section>
<p>Write code in Ansible's <b>YAML language</b>:</p>
<ul>
<li>structure things into <b>roles</b></li>
<li>orchestrate roles across your infrastructure in <b>playbooks</b></li>
</ul>
</section>
<section>
<pre><code>---
# roles/varnish/tasks/main.yml
- name: Install the varnish package
apt: name=varnish state=installed
- name: Write varnish config files
template: src={{ item.template }} dest={{ item.dest }} mode=0644
with_items:
- dest: /etc/default/varnish
src: etc_default_varnish.j2
- dest: /etc/varnish/default.vcl
src: etc_varnish_default.vcl.j2
- name: Manage varnish service
service: name=varnish state={{ varnish_service_state }}
</code></pre>
</section>
<section>
<pre><code>---
# playbooks/webtier.yml
- name: Provision webservers
hosts: web
roles:
- common
- apache
- name: Provision reverse proxies
hosts: proxies
roles:
- common
- varnish
</code></pre>
</section>
<section>
<img src="galaxy.png"/>
Open Source Roles from Ansible Galaxy
</section>
<section>
<pre><code>--- | ---
# inventory/group_vars/all/vars.yml | # inventory/group_vars/web/vars.yml
ssh_enabled: true | ssh_root_login: true
ssh_root_login: false |
| password_hashes:
password_hashes: | root: ""
root: "$6$deadbeef" | felix: "{{ password_hashes.felix }}"
felix: "$6$acceff00" | gitlab_ssh_key: "{{ vault_gitlab_ssh_key }}"
</code></pre>
customize machines and groups using <b>variables</b>
</section>
<section>
<img src="ansible-arch.svg" style="width: 75%"/>
<p>run from anywhere using <b>ssh</b></p>
</section>
<section>
<img src="foreman.png"/>
<p class="source">http://projects.theforeman.org/projects/foreman/wiki/Screenshots</p>
<p>Foreman supports Ansible as well</p>
</section>
<section>
<img src="difficult.png"/>
<p class="source">https://img.memecdn.com/youre-doing-it-wrong_o_195760.jpg</p>
<p>not very comfortable without <b>Ansible Tower</b><br/>
(now <b>awx</b>)</p>
</section>
</section>
<section>
<p class="large">We've seen the parallels</p>
<p class="large fragment fade-in" style="transform: rotateZ(180deg);">
Now for the differences</p>
</section>
<section>
<p class="large">Puppet models systems</p>
<ul>
<li>system state will (should) converge</li>
<li>equilibrium often after single transaction</li>
<li>each machine has a definitive catalog of state</li>
</ul>
</section>
<section>
<div class="title">The Puppet Model</div>
<section><img src="demo-infra.png"/></section>
<section><img src="demo-infra-puppet1.png"/></section>
<section><img src="demo-infra-puppet2.png"/></section>
<section><img src="demo-infra-puppet3.png"/></section>
<section><img src="demo-infra-puppet4.png"/></section>
<section><img src="demo-infra-puppet5.png"/></section>
<section><img src="demo-infra-puppet6.png"/></section>
<section><img src="demo-infra-puppet7.png"/></section>
</section>
<section>
<p class="large">Ansible models<br/>distributed activity</p>
<ul>
<li>structured like a script, convergence is up to the user</li>
<li>a play in a playbook is like a view or projection</li>
<li>assigns tasks to hosts, rather than state</li>
</ul>
</section>
<section>
<div class="title">The Ansible Model</div>
<section><img src="demo-infra.png"/></section>
<section><img src="demo-infra-ansible1.png"/></section>
<section><img src="demo-infra-ansible2.png"/></section>
<section><img src="demo-infra-ansible3.png"/></section>
<section><img src="demo-infra-ansible4.png"/></section>
<section><img src="demo-infra-ansible5.png"/></section>
<section><img src="demo-infra-ansible6.png"/></section>
<section><img src="demo-infra-ansible7.png"/></section>
<section><img src="demo-infra-ansible8.png"/></section>
<section><img src="demo-infra-ansible9.png"/></section>
<section><img src="demo-infra-ansible10.png"/></section>
<section><img src="demo-infra-ansible11.png"/></section>
<section><img src="demo-infra-ansible12.png"/></section>
</section>
<section>
<p class="large">In Summary</p>
</section>
<section>
<div class="title">Ansible v Puppet</div>
<section><img src="demo-infra-ansible-v-puppet.png"/></section>
</section>
<section>
<p>Or let's use a metaphor</p>
</section>
<section>
<p class="large">Imagine your infrastructure was a theatre stage</p>
</section>
<section>
<img src="theatre-puppet.png"/>
</section>
<section>
<img src="theatre-ansible.png"/>
</section>
<!--
<section>
TODO: drawing of actors with cameras, headphones, mgmt shirts
</section>
-->
<section>
<p>So don't try to push Ansible into a Puppet-shaped box.</p>
<img src="liquid-cat.jpg"/>
<p class="source">https://img.memecdn.com/youre-doing-it-wrong_o_195760.jpg</p>
</section>
<section>
<div class="title">Some Ansible tips</div>
<section>
<p>Having a site.yml is nice, but it should not be<br/>the primary use case.</p>
<p>Running the code for all machines will become<br/>too slow sooner or later.</p>
</section>
<section>
<p>Tags aren't very flexible.</p>
<p>Better to rely on single-purpose playbooks.</p>
<p>Create ad-hoc playbooks whenever you need.</p>
</section>
<section>
<p>Don't shoot for DRY on <b>playbook</b> level.</p>
<p>But do make DRY <b>roles</b>.</p>
</section>
<section>
<p>Take advice on best practices<br/>
from the upstream Ansible documentation<br/>
with a grain of salt.</p>
</section>
</section>
<section><p class="large">Let's look at site.yml</p></section>
<section>
<div class="title">Ansible in Puppet-like mode</div>
<section><img src="siteyml1.png"/></section>
<section><img src="siteyml2.png"/></section>
<section><img src="siteyml3.png"/></section>
<section><img src="siteyml4.png"/></section>
<section><img src="siteyml5.png"/></section>
<section><img src="siteyml6.png"/></section>
<section><img src="siteyml7.png"/></section>
</section>
<section>
<p>Use the tooling.</p>
<p class="large">Orchestrate</p>
</section>
<section>
<div class="title">Proper Ansible</div>
<section><img src="orchestrate1.png"/></section>
<section><img src="orchestrate2.png"/></section>
<section><img src="orchestrate3.png"/></section>
<section><img src="orchestrate4.png"/></section>
<section><img src="orchestrate5.png"/></section>
<section><img src="orchestrate6.png"/></section>
<section><img src="orchestrate7.png"/></section>
<section><img src="orchestrate8.png"/></section>
<section><img src="orchestrate9.png"/></section>
</section>
<section>
<div class="title">When to choose Ansible over Puppet</div>
<section>
<ul>
<li>need to cover code deployments?</li>
<li class="fragment">primarily managing switches and similar gear?</li>
<li class="fragment">many use cases for "ad hoc" management?</li>
<li class="fragment">ubiquitous Python but no Ruby?</li>
</ul>
</section>
</section>
<section>
<div class="title">When to choose Puppet over Ansible</div>
<section>
<ul>
<li>managing only OS level system properties?</li>
<li class="fragment">very heterogeneous environment?</li>
<li class="fragment">you value power over simplicity?</li>
<li class="fragment">ubiquitous Ruby but no Python?<br/>
(or Python 3 only?)</li>
<li class="fragment">you are certain that scale will be huge</li>
</ul>
</section>
</section>
<section>
<div class="title">Should I combine both?</div>
<section>
<p style="margin-bottom: 2em">Only if you know what you are doing.</p>
<p>There is value in limiting your tool chain.</p>
</section>
</section>
<section>
<p>Finally, what's the best way to lead discussions about
config management tools?</p>
<p class="fragment">Well...</p>
</section>
<section data-background-image="hugs.jpg" style="background-position: center">
<!-- <div style="position: absolute; bottom: 0px; height: 32px; right: 0px"> -->
<p class="source" style="margin-top: 70%">http://www.mrwallpaper.com/wallpapers/man-tiger-hug-1024x1024.jpg</p>
<!-- </div> -->
</section>
<section>
<p class="large">Thanks for listening!</p>
</section>
<section>
<p>We are filling many (not only tech) roles!</p>
<img src="careers.png"/>
<p>Check out our <a href="https://www.unbelievable-machine.com/en/careers/">careers page</a></p>
</section>
<section>
<p class="large">Questions?</p>
</section>
<section>
<div class="title">Testing tools</div>
<section>
<table>
<tr><th>Style</th><th>Puppet</th><th>Ansible</th></tr>
<tr><td>Preview</td><td>--noop</td><td>--check</td></tr>
<tr><td>Unit</td><td>rspec-puppet</td><td>N/A</td></tr>
<tr><td>Static</td><td>catalog-diff</td><td>N/A</td></tr>
<tr><td>Acceptance</td><td>beaker</td><td>testinfra</td></tr>
</table>
</section>
</section>
<section>
<div class="title">Attributions</div>
<section>
<ul>
<li>The Git logo, available under <a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons 3.0</a>.</li>
<li>The Jenkins logo: <a href="https://jenkins.io/">https://jenkins.io/</a></li>
</ul>
</section>
</section>
</div>
<div id="footer" style="background: #0085ac;
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
height:24px;
color: white;
font-size: 20px;
padding: 4px;">
<span style="float: left; width: 33%;">
@felis_rex / ffrank
</span>
<span style="float: left; left: 33%; width: 33%; text-align: center;">
Puppet vs. Ansible
</span>
<span style="float: left; right: 0px; width: 33%; text-align: right;">
CfgMgmtCamp 2018
</span>
</div>
<div id="myLogo" style="background: url(um-logo.png);
position: absolute;
bottom: 34px;
right: 10px;
width: 125px;
height: 103px;">
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: false,
progress: true,
history: true,
center: true,
transition: 'fade', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
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, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>