Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AnsibleWorkshopMay2019.pdf
Search
Andreas Mosti
May 14, 2019
Programming
0
250
AnsibleWorkshopMay2019.pdf
https://dipsas.github.io/AnsibleCourse/
Andreas Mosti
May 14, 2019
Tweet
Share
More Decks by Andreas Mosti
See All by Andreas Mosti
Deterministic Builds and where to find them
andmos
0
36
Correct Maps Are Useless: A guide to mental models
andmos
0
160
LEGO I Praksis
andmos
0
59
Supply Chain Attacks: Når den digitale forsyningslinja blir angrepsvektor
andmos
0
31
IoIT: Internet of Insecure Things
andmos
0
120
Containers'n stuff
andmos
0
36
IoT - Bevisstgjøring
andmos
0
39
GitOps in a nutshell
andmos
0
190
Supply Chain Attack
andmos
0
47
Other Decks in Programming
See All in Programming
JSONataを使ってみよう Step Functionsが楽しくなる実践テクニック #devio2025
dafujii
0
260
時間軸から考えるTerraformを使う理由と留意点
fufuhu
12
4k
Claude Codeで挑むOSSコントリビュート
eycjur
0
190
TanStack DB ~状態管理の新しい考え方~
bmthd
2
440
Laravel Boost 超入門
fire_arlo
2
180
2025 年のコーディングエージェントの現在地とエンジニアの仕事の変化について
azukiazusa1
16
7.3k
Design Foundational Data Engineering Observability
sucitw
2
140
Microsoft Orleans, Daprのアクターモデルを使い効率的に開発、デプロイを行うためのSekibanの試行錯誤 / Sekiban: Exploring Efficient Development and Deployment with Microsoft Orleans and Dapr Actor Models
tomohisa
0
230
TDD 実践ミニトーク
contour_gara
1
280
Langfuseと歩む生成AI活用推進
licux
3
320
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
410
KessokuでDIでもgoroutineを活用する / Go Connect #6
mazrean
0
140
Featured
See All Featured
The Language of Interfaces
destraynor
160
25k
Practical Orchestrator
shlominoach
190
11k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Embracing the Ebb and Flow
colly
87
4.8k
What's in a price? How to price your products and services
michaelherold
246
12k
A better future with KSS
kneath
239
17k
Writing Fast Ruby
sferik
628
62k
Unsuck your backbone
ammeep
671
58k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Transcript
and infrastructure as code workshop Andreas Mosti
Key takeaways • Infrastructure as Code • Configuration Management •
What can Ansible solve? • What can it not solve? • Enough knowledge to understand the key principles
Dev/Build Runtime
Dev/Build Runtime
Dev/Build Runtime
Dev/Build Runtime
None
The complexity moves
None
None
Site A Site A Replica Site B Replica Site B
• Application platforms / runtimes • Permissions • Users •
Firewall rules • Config Files • Updates • Running Services • Upgrades
• Application platforms / runtimes • Permissions • Users •
Firewall rules • Config Files • Updates • Running Services • Upgrades 20
None
Inconsistent server farms
Platform requirements, «What are we releasing on?»
«We need new environments quickly, in a reproducible fashion»
Automate the infrastructure
Snowflake vs. Phoenix Servers
Infrastructure as code:
Reproducible Environments
Servers in version control
Configuration management
Explicit process
Safety!
Code Review
Baked vs. Fried servers
The usual suspects
None
None
Why Ansible?
None
None
Open Source
SSH WinRM
Most important:
The correct abstraction (for us)
None
Playbooks push Database Appserver Load Balancer
None
Remember: Ansible keeps state
The benefits of Infrastructure as Code: 1) Automation 2) Version
control 3) Code Review 4) Testing 5) Documentation 6) Reuse
The holy grale: Imutable infrastructure
Warning 1:
None
None
None
None
The files don’t represent reality!
None
Warning 2:
If not run often, the system might regress
Part 1: Inventory and connection
SSH WinRM
WinRM Port 5986 Local / AD admin user w. remoting
Powershell 3.0 ConfigureRemotingForAnsible.ps1
SSH Port 22 root / dedicated user(s)
None
None
The Inventory
inventory/Example.inventory
inventory/Testlab18.inventory
Exercise 1: Inventory and server connection
Part 2: Playbooks and tasks
Playbooks push Database Appserver Loadbalancer
LoadBalancer.yaml Zookeeper.yaml Solr.yaml Database.yaml ArenaAppServer.yaml
WebServer.yaml
WebServer.yaml
WebServer.yaml
WebServer.yaml
roles/DotNet461/tasks/main.yaml
None
None
Exercise 2: Playbook and simple tasks
Part 3: Roles and variables
WebServer.yaml
To reuse tasks or implement components, we make roles
Example roles: • IIS • DotnetFramework45 • Oracle12C • TeamcityAgent
• Java • GoogleChrome • SplunkForwarder
None
Buildserver.yaml
roles/Oracle12Driver/tasks/main.yaml
roles/Oracle12Driver/tasks/main.yaml
roles/Oracle12Driver/defaults/main.yaml
Lists and iterators
roles/Zookeeper/tasks/main.yaml roles/Zookeeper/defaults/main.yaml
A word on variable precendence
From least to most important: • role defaults • group_vars/
• host_vars/ • host facts • play vars • include_vars • set_facts • extra vars
A word on state and idempotency
Always pick modules over shell commands (if possible)
roles/MKDocs/tasks/main.yaml
roles/MKDocs/tasks/main.yaml
Exercise 3: Roles, variables and iterators
Part 4: Handlers, templates, files
None
Files vs Templates
roles/TeamCityAgent/tasks/main.yaml
True configuration management with templating and JINJA2
roles/TeamCityAgent/templates/buildAgent.properties
roles/SplunkForwarder/templates/input.conf.j2
roles/HAProxy/templates/haproxy.conf.j2
roles/Prometheus/templates/alertmanager.yml.j2
roles/Prometheus/defaults/main.yml
roles/TeamCityAgent/tasks/main.yaml
roles/TeamCityAgent/handlers/main.yaml
Exercise 4: Templates, handlers and files
Part 5: Ansible Vault
When working with secrets roles/TeamCityAgent/tasks/main.yaml
roles/TeamCityAgent/defaults/main.yaml
None
roles/TeamCityAgent/defaults/main.yaml
None
roles/TeamCityAgent/defaults/main.yaml
Exercise 5: Vault and encryptet secrets