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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Steven Ringo
March 12, 2015
Programming
2
1.6k
Ansible: 10 tips and tricks
Tips and tricks for Ansible. Code at git.io/pK57
Steven Ringo
March 12, 2015
Tweet
Share
More Decks by Steven Ringo
See All by Steven Ringo
Disrupt yourself with a real-time, customer-centric data platform
stevenringo
0
100
Anticorrupting the Enterprise; or How I Learned to Stop Worrying and Love the Serverless
stevenringo
0
390
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
910
Building APIs that delight (Part I)
stevenringo
1
230
Programming fundamentals for non-techies
stevenringo
2
360
RubyMotion - the good, the bad and the ugly.
stevenringo
0
310
Technical Cofounding 101
stevenringo
0
190
Other Decks in Programming
See All in Programming
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
240
CSC307 Lecture 15
javiergs
PRO
0
240
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.6k
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
100
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
手戻りゼロ? Spec Driven Developmentとは@KAG AI week
tmhirai
1
190
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2k
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
360
AI駆動開発の本音 〜Claude Code並列開発で見えたエンジニアの新しい役割〜
hisuzuya
4
490
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
4
410
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
170
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
3.5k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
210
The Limits of Empathy - UXLibs8
cassininazir
1
250
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
68
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
61
52k
Accessibility Awareness
sabderemane
0
76
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
67
37k
Paper Plane (Part 1)
katiecoart
PRO
0
5.4k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
190
Test your architecture with Archunit
thirion
1
2.2k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
120
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
97
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