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
Ansible: 10 tips and tricks
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Steven Ringo
March 12, 2015
Programming
1.6k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ansible: 10 tips and tricks
Tips and tricks for Ansible. Code at git.io/pK57
Steven Ringo
March 12, 2015
More Decks by Steven Ringo
See All by Steven Ringo
Disrupt yourself with a real-time, customer-centric data platform
stevenringo
0
110
Anticorrupting the Enterprise; or How I Learned to Stop Worrying and Love the Serverless
stevenringo
0
400
Going serverless– NoOps is the best ops
stevenringo
2
320
Ansible vs CloudFormation Smackdown!
stevenringo
6
3.8k
CloudFormation tips, tricks & best practices
stevenringo
0
930
Building APIs that delight (Part I)
stevenringo
1
240
Programming fundamentals for non-techies
stevenringo
2
370
RubyMotion - the good, the bad and the ugly.
stevenringo
0
310
Technical Cofounding 101
stevenringo
0
200
Other Decks in Programming
See All in Programming
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
560
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
580
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
130
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
170
act1-costs.pdf
sumedhbala
0
120
Webフレームワークの ベンチマークについて
yusukebe
0
180
JavaDoc 再入門
nagise
1
420
Agentic UI
manfredsteyer
PRO
0
200
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
110
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
410
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
130
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
180
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
52k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
170
Speed Design
sergeychernyshev
33
1.9k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
エンジニアに許された特別な時間の終わり
watany
107
250k
Why Our Code Smells
bkeepers
PRO
340
58k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
250
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
240
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Transcript
10 tips & tricks Sydney Ansible Meetup, Thursday 12 March
2015 Dynamic Clarity
define variables with a JSON web service 1
{ "server_ip": "192.168.0.44", "server_name": "dilbert" } https://api.site.com/config/staging
{ "server_ip": "10.10.11.34", "server_name": "pointy_haired_boss" } https://api.site.com/config/production
multi-stage environments 2
!"" inventory # !"" _common # # $"" inventory #
!"" production # # !"" group_vars # # # $"" all # # !"" host_vars # # $"" inventory -> ../_common/inventory # $"" staging # !"" group_vars # # $"" all # !"" host_vars # $"" inventory -> ../_common/inventory
ansible_connection=local for local connections, use 3
single self-contained repo 4
remove global config (/usr/local/etc/ansible/hosts) keep SSH config in Ansible project
check out repo and run!
cloud-local control host 5
co-located on same VPC / VLAN
~zero latency no public SSH repo access required
buildkite.com* for deployment 6
install agent on Ansible control host
None
use roles 7
don’t use roles, use include
roles can’t strictly be mixed with tasks
pre_tasks: - remove host from load balancer pool roles: -
rails tasks: - do stuff post_tasks: - return load balancer back to pool
pre_tasks: - remove host from load balancer pool tasks: -
do stuff - role: nginx - do more other stuff - role: rails post_tasks: - return load balancer back to pool
roles/ nginx/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/
$ ansible-galaxy init
Ruby* modules 8
located in /library must be executable task name is file
name
#!/usr/bin/env ruby # WANT_JSON shebang warning!
*any executable that can read a JSON formatted file (input)
and returns JSON to stdout (output)
instant offline access to documentation 9
Dash Alfred +
10 style
- name: Install Nginx. yum: name=nginx state=installed
- name: copy something template: src: "templates/config.j2" dest: "/home/{{ deploy_user
}}/config" owner: "{{ deploy_user }}" group: "{{ deploy_user }}" mode: 0755
- name: copy something template: > src="templates/config.j2" dest="/home/{{ deploy_user }}/config"
owner="{{ deploy_user }}" group="{{ deploy_user }}" mode=0755
multiline for single parameter = good
- name: decrypt the key on the server sudo_user: "{{
deploy_key_user }}" command: > openssl rsa -in {{ deploy_key_path }}.protected -out {{ deploy_key_path }} -passin pass:{{ deploy_key_secret }}
git.io/pK57
None
ansibleworkshop.com
Steven Ringo | stevenringo |
[email protected]
Dynamic Clarity