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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
AWS Summit 2026で見えたSIerにとっての Amazon Quickの位置づけ
maf_0521
0
120
Lightning近況報告
kozy4324
0
230
From Prompt Engineering to Loop Engineering
shibuiwilliam
1
280
Agile and AI Redmine Japan 2026
hiranabe
4
500
AI時代における最適なQA組織の作り方
ymty
3
170
toB プロダクトから見たWAF
tokai235
0
250
AIエージェントとPhysical AIが拓く製造業の変革(ハノーバーメッセリキャップ)
iotcomjpadmin
0
170
アラート調査向けAIエージェントの本番導入とその後/AI Agents for Alert Investigation: Production Deployment and After
taddy_919
1
250
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
7.7k
データレイクの「見えない問題」を可視化する
sansantech
PRO
1
230
GitHub Copilot運用のリアル ~AI Credit時代にどう向き合うか~
takafumisu2uk1
0
490
技術・能力を向上する原理原則 #きのこセッションa #きのこ2026
bash0c7
0
140
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
GraphQLとの向き合い方2022年版
quramy
50
15k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Designing for Timeless Needs
cassininazir
1
260
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
For a Future-Friendly Web
brad_frost
183
10k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Crafting Experiences
bethany
1
190
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
250
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
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/ • ͋Β͔͡ΊಡΜͰ͖ͯؾʹͳͬͨɺΘ͔Βͳ͔ͬ
ͨͱ͜ΖΛஶऀʹฉ͘ձͰ͢