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 2.0 at Ansible Meetup in Tokyo 2015.09
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
shirou
September 14, 2015
Technology
8.8k
10
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ansible 2.0 at Ansible Meetup in Tokyo 2015.09
shirou
September 14, 2015
More Decks by shirou
See All by shirou
Sphinx-themes.org in Sphinx-con 2018
shirou
0
2.4k
Generate better JavaScript From Goa Design
shirou
0
1.4k
sphinxからAnsible Playbookを読み込む
shirou
3
710
ansible x sphinx for ssmjp-2016-07-29 but-not-used
shirou
0
160
Sphinx with Markdown
shirou
2
24k
code generation from C in gopsutil
shirou
1
6.3k
Other Decks in Technology
See All in Technology
AI工学特論: MLOps・継続的評価
asei
4
120
なぜ、あなたのエージェントは言うことを聞かないのか
segavvy
1
200
AIとハーネスで育てるトランスコンパイラ / 20260722 Yasushi Katayama
shift_evolve
PRO
3
730
インシデント事例と パッケージの全量解析に学ぶ ソフトウェアサプライチェーンの守り方 / supply-chain-attack-defense
flatt_security
0
850
“それは自分の仕事じゃない"を越えて行け
yuukiyo
1
510
AIが当たり前の組織で エンジニアはどう育つか
nishihira
1
910
ソニー銀行におけるビジネスアジリティ向上のためのクラウドシフト戦略
srenext
0
1k
発表と総括 / Presentations and Summary
ks91
PRO
0
180
Network Firewallやっていき!
news_it_enj
0
260
壊して学ぶAWS CDK: そのcdk deployで消えるもの、残るもの
k_adachi_01
1
460
CDKで書くECSのベストプラクティス、 改めて考え直す2026 #cdkconf2026
makies
3
920
実践!既存 Project への AI-Driven Development 適用〜 一ヶ月で Project 唯一のフロントエンドエンジニアを作り出せ〜
lycorptech_jp
PRO
0
380
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
11
38k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
410
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
410
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
320
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.6k
Speed Design
sergeychernyshev
33
1.9k
New Earth Scene 8
popppiees
3
2.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
330
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
190
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.8k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.1k
Transcript
Ansible 2.0 @r_rudi एࢁ࢙ (πΩϊϫגࣜձࣾ)
͓લͩΕΑ • एࢁ ࢙@r_rudi / πΩϊϫגࣜձࣾ CTO • WebΞϓϦ։ൃ͔Βӡ༻·Ͱ •
ීஈgolangͰWebΞϓϦॻ͍ͯ·͢ • ஶॻʮೖAnsibleʯ • Amazonʹͯൢചத(ిࢠॻ੶)
Ansible 2.0ͱ • ࠷৽1.9.3 (1.9.4͕rc2) • 1ܥͱฏߦͯ͠2ܥ͕͍ؒ։ൃ͞Ε͍ͯͨ • গͳ͘ͱࠓ2݄Ҏ߱ •
෦ߏΛ΄΅Ұ͔Βॻ͖ͨ͠ • ίʔυ໊: ”Over the Hills and Far Away” (Led Zeppelin)
2.0Ͱ࠷ॏཁͳ • ࠓ͜Ε͚ͩΛ֮͑ͯؼͬͯԼ͍͞ • ैདྷͷplaybookͱ100%ޓੑ͕͋Γ·͢ • طଘͷplaybookΛม͑Δඞཁ͋Γ·ͤΜ Λɺࢦ͍ͯ͠·͢
Ճػೳ
block • taskΛ͞ΒʹׂͰ͖·͢ tasks: - block: - yum: name={{ item
}} state=installed with_items: - httpd - memcached - template: src=templates/src.j2 dest=/etc/foo.conf - service: name=bar state=started enabled=True when: ansible_distribution == 'CentOS'
blockʹΑΔྫ֎ॲཧ tasks: - block: - debug: msg='࣮ߦ͞Ε·͢' - fail: msg=“fail!!!”
- debug: msg=‘Τϥʔ͕ى͖ΔͨΊɺ࣮͜͜ߦ͞Ε·ͤΜ' rescue: - debug: msg=‘Τϥʔ͕͓͖·ͨ͠' - fail: msg=“rescueͰfail!!” - debug: msg='࣮͜͜ߦ͞Ε·ͤΜ' always: - debug: msg="ඞ࣮ͣߦ͞Ε·͢"
blockͰઃఆͷ্ॻ͖ - hosts: remote_user: someuser tasks: - block: - shell:
whoami - shell: touch /etc/hosts become_user: root
strategy plugin • λεΫ࣮ߦઓུΛมߋ͢Δ • linear: શϗετͷ࣮ߦऴྃΛͭ(v1ͱಉ͡) • free: ͨͣʹͲΜͲΜ࣮ߦ͍ͯ͘͠
• pluginͳͷͰɺՃՄೳ
includeͰwith͕͑ΔΑ͏ʹ • includeมΛ্ॻ͖Ͱ͖͕ͨɺwithʹΑΔ ܁Γฦ͠Ͱ͖ͳ͔ͬͨɻ tasks: - include: foo.yml some_var={{ item
}} with_items: [‘a’, ‘b’, ‘c’]
includeͰมΛ͏ • ैདྷมల։͕ग़དྷͳ͔ͬͨ • distributionຖʹwhenΛॻ͘ΑΓߦઅ - include: included_{{ inventory_hostname }}.yml
meta: refresh_inventory • inventoryϑΝΠϧ࠷ॳͷҰճ͔͠ಡΈࠐ· ͳ͔ͬͨ • dynamic inventoryͳͲͰʹ tasks:
- meta: refresh_inventory
taskϨϕϧͰͷม • taskϨϕϧͰఆٛɾ্ॻ͖͕Մೳʹ vars: aa: "AA" tasks: - debug: msg="{{
aa }}" - debug: msg="{{ aa }}" vars: aa: “BB" - debug: msg="{{ aa }}” -> AA -> BB -> AA
Ϟδϡʔϧ/pluginͷՃ • 140Ҏ্ͷ৽نϞδϡʔϧͷՃ • openstackɺdockerɺzabbixɺvmware… • inventory, connection pluginՃ •
serf, consul, dockerͳͲ • callback plugin͕ಉࠝɻansible.cfgʹॻ͚ͩ͘Ͱ༗ޮ Խ(callback_whitelist)
ྫ: profile_tasks plugin [defaults] callback_whitelist = profile_tasks TASK [debug msg={{
aa }}] ****************************************************** Monday 14 September 2015 16:00:20 +0900 (0:00:00.074) 0:00:00.162 ****** ok: [localhost] => { "changed": false, "msg": "AA" } Monday 14 September 2015 16:00:20 +0900 (0:00:00.078) 0:00:00.241 ****** =============================================================================== TASK: debug msg={{ aa }} ------------------------------------------------ 0.08s TASK: debug msg={{ aa }} ------------------------------------------------ 0.08s TASK: debug msg={{ aa }} ------------------------------------------------ 0.07s
มߋ෦
෦ߏͷཧ • มཧ (VariableManager) • ैདྷมͷཧʹ͕ଟ͔ͬͨ • มల։ͷॱং͕͔ΓͮΒ͔ͬͨ • pluginߏͷཧ
• ܧঝߏͷཧ
෦APIͷมߋ • ࣗ࡞pluginʹଟগͷมߋ͕ඞཁ • lookupLookupBase classΛܧঝ͢ΔΑ͏ʹ • callback ‘v2_’ Λ͚Δ
• connection΄ͱΜͲͷਓ͕࡞͍ͬͯͳ͍ͣ • filterมߋͳ͠
ࣗ࡞Ϟδϡʔϧ • Ҿͷ͠ํ͕มΘͬͨͷͰɺมߋ͕ඞཁʹ ͳΓ·͢ • http://qiita.com/h-hirokawa/items/ 8eecd64d01ad80175179
ࡉ͔ͳมߋ • templateͰboolΛจࣈܕʹม͍͕ͯͨ͠ɺม ߋ͠ͳ͍Α͏ʹ • ۭͷมͱNoneΛۭനʹม͍͕ͯͨ͠ɺมߋ͠ͳ͍ Α͏ʹ • jinja2ͰͷΤεέʔϓͰ \\
ͱ͍ͯͨ͠ͷΛ \ ʹ • YAMLϑΝΠϧதͰ > Λ͍ͬͯͨ߹ʹ࠷ޙͷվߦ Λͦͷ··͢Α͏ʹ
python 3ରԠ • ೦ͳ͕ΒೖΓ·ͤΜͰͨ͠ • ͨͩ͠ɺ४උਐΊ͍ͯΔ༷ࢠ • python 3ରԠPRΛड͚ೖΕ͍ͯΔ
·ͱΊ • Ansible 2.0ɻ·ͩग़ͯ·ͤΜɻɻɻ • playbookͷޓੑ 100% • 140Ҏ্ͷϞδϡʔϧͷՃ •
blockʹΑΔྫ֎ॲཧͷՃ • ࣗ࡞ͷpluginʹमਖ਼͕ඞཁ
એ: PythonΤϯδχΞཆಡຊ • AnsibleͷΛॻ͍ͯ·͢ • 9݄17ʹansibleষͷಡॻձΛΓ·͢ • http://pymook.connpass.com/ • ͋Β͔͡ΊಡΜͰ͖ͯؾʹͳͬͨɺΘ͔Βͳ͔ͬ
ͨͱ͜ΖΛஶऀʹฉ͘ձͰ͢