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
90
Anticorrupting the Enterprise; or How I Learned to Stop Worrying and Love the Serverless
stevenringo
0
340
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
820
Building APIs that delight (Part I)
stevenringo
1
190
Programming fundamentals for non-techies
stevenringo
2
320
RubyMotion - the good, the bad and the ugly.
stevenringo
0
300
Technical Cofounding 101
stevenringo
0
170
Other Decks in Programming
See All in Programming
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
380
使ってみよう Azure AI Document Intelligence
kosmosebi
2
270
Hanami and htmx
bkuhlmann
0
200
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
260
Folding Cheat Sheet #3
philipschwarz
PRO
0
120
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
260
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
340
雑に思考を整理する技術と効能
konifar
58
28k
エンターテイメント業界で利用されるAWS
demuyan
0
210
新宿ダンジョンを可視化してみた
satoshi7190
2
220
Java 22 Overview
kishida
1
180
[技育CAMPアカデミア]アイディアを形に!【超入門】スマホアプリ開発〜リリースまでの流れをご紹介
teamlab
PRO
0
360
Featured
See All Featured
KATA
mclloyd
14
12k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
How STYLIGHT went responsive
nonsquared
92
4.8k
Thoughts on Productivity
jonyablonski
57
3.8k
Designing the Hi-DPI Web
ddemaree
276
33k
Six Lessons from altMBA
skipperchong
20
3k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
356
22k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
Being A Developer After 40
akosma
56
580k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
Documentation Writing (for coders)
carmenintech
59
3.9k
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