Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ansible 2.0 at Ansible Meetup in Tokyo 2015.09
Search
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
720
ansible x sphinx for ssmjp-2016-07-29 but-not-used
shirou
0
160
Sphinx with Markdown
shirou
2
25k
code generation from C in gopsutil
shirou
1
6.3k
Other Decks in Technology
See All in Technology
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
370
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
5
1.8k
Antigravity SDK for the Java Developer
glaforge
0
140
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
180
What the customer really needed
kawaguti
PRO
3
220
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
9
4.9k
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
410
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
300
Cloudflare Workers 向けアプリを C# で構築する ~WASM Native AOT への道~
nenonaninu
1
760
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
AI 時代のスタートアップエコシステ厶から考究する技術的負債との向き合い方
m3m0r7
PRO
3
2.5k
アクセスキーこわい やめかたと漏らさない工夫
sassssan68
1
560
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1033
470k
Docker and Python
trallard
47
4.2k
Google's AI Overviews - The New Search
badams
0
1.6k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
410
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
HDC tutorial
michielstock
2
880
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Thoughts on Productivity
jonyablonski
76
5.4k
The Curse of the Amulet
leimatthew05
3
15k
Embracing the Ebb and Flow
colly
88
5.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
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/ • ͋Β͔͡ΊಡΜͰ͖ͯؾʹͳͬͨɺΘ͔Βͳ͔ͬ
ͨͱ͜ΖΛஶऀʹฉ͘ձͰ͢