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
Steven Ringo
March 12, 2015
Programming
1.6k
2
Share
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
310
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
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
1.1k
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
490
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.4k
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
140
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
510
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
620
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.2k
開発体験を左右するライブラリの API 設計 - GraphQL スキーマ構築ライブラリから考える #tskaigi
izumin5210
2
1.6k
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
290
Webフレームワークの ベンチマークについて
yusukebe
0
120
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
190
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
320
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
520
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
My Coaching Mixtape
mlcsv
0
140
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
190
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
720
Visualization
eitanlees
152
17k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
220
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Music & Morning Musume
bryan
47
7.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
860
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
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