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
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
93
Anticorrupting the Enterprise; or How I Learned to Stop Worrying and Love the Serverless
stevenringo
0
350
Going serverless– NoOps is the best ops
stevenringo
2
280
Ansible vs CloudFormation Smackdown!
stevenringo
6
3.7k
CloudFormation tips, tricks & best practices
stevenringo
0
840
Building APIs that delight (Part I)
stevenringo
1
200
Programming fundamentals for non-techies
stevenringo
2
340
RubyMotion - the good, the bad and the ugly.
stevenringo
0
300
Technical Cofounding 101
stevenringo
0
180
Other Decks in Programming
See All in Programming
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.7k
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
220
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
340
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
110
Security_for_introducing_eBPF
kentatada
0
110
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
130
return文におけるstd::moveについて
onihusube
1
1.1k
快速入門可觀測性
blueswen
0
370
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
480
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
470
Featured
See All Featured
Unsuck your backbone
ammeep
669
57k
A Philosophy of Restraint
colly
203
16k
Optimizing for Happiness
mojombo
376
70k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
Designing Experiences People Love
moore
138
23k
What's in a price? How to price your products and services
michaelherold
243
12k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
The Invisible Side of Design
smashingmag
298
50k
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