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/ansiblejp-20180803
Search
Kunihiro Morita
August 03, 2018
Technology
2
2.6k
夏休みで差がつく!Ansible/ansiblejp-20180803
Ansible Night in Fukuoka 2018.08 の資料です。 #ansiblejp
https://ansible-users.connpass.com/event/93620/
Kunihiro Morita
August 03, 2018
Tweet
Share
More Decks by Kunihiro Morita
See All by Kunihiro Morita
絵で覚える AWS 全 (?) サービス入門 〜 できるAWSカルタ 〜/jawsug-20191019
morita92hiro
1
2.3k
決戦用MSセンチネル/alterbooth-20190606
morita92hiro
1
250
勝手にAlibaba Cloud White Beltシリーズ Elastic Compute Service(ECS)/alieaters-20190301
morita92hiro
0
400
希望のRancher〜コンテナをアウフヘーベン〜/ranchermeetup-20171006
morita92hiro
0
280
いまからDockerで始めるGitLab CE/gitlabjp-20170919
morita92hiro
1
1.4k
月額10円から作るServerless Website〜Azure編〜/serverlessfukuoka-20170825
morita92hiro
8
17k
コンテナ運用いきのこるには/ranchermeetup-20170807
morita92hiro
1
570
AWS Summit Tokyoをお探しですか?/jawsug-20170713
morita92hiro
0
170
ブラウザだけでインフラ操作?〜これさえあれば、何もいらない。〜/fukuazu-20170622
morita92hiro
1
910
Other Decks in Technology
See All in Technology
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
120
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
350
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
120
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
5
200
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
200
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
170
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
560
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
17
16k
非機能品質を作り込むための実践アーキテクチャ
knih
5
1.5k
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
290
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6.1k
It's Worth the Effort
3n
183
28k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Statistics for Hackers
jakevdp
796
220k
The Cost Of JavaScript in 2023
addyosmani
45
7k
Typedesign – Prime Four
hannesfritz
40
2.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
How STYLIGHT went responsive
nonsquared
95
5.2k
The Invisible Side of Design
smashingmag
298
50k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Transcript
ՆٳΈͰ͕ࠩͭ͘ʂ Ansible #ansiblejp 2018/8/3 Ansible Night in Fukuoka 2018.08 1
ా༟ גࣜձࣾΦϧλʔϒʔε ιϦϡʔγϣϯΞʔΩςΫτ ΈࠐΈ → ΫϥυΠϯϑϥ @morita92hiro https://hawaku.hateblo.jp 2018/8/3 Ansible
Night in Fukuoka 2018.08 2
Ansibleపఈೖ ൃചதʂ 2018/8/3 Ansible Night in Fukuoka 2018.08 3
ͭ·Βͳ͍ੈք͔Βͬͱܹͷ͋ΔੈքมԽͤ͞Α͏ʂ ɹɹɹɹɹ 2018/8/3 Ansible Night in Fukuoka 2018.08 4
2018/8/3 Ansible Night in Fukuoka 2018.08 5
Ansibleͱ1 1 https://www.ansible.com/overview/it-automation 2018/8/3 Ansible Night in Fukuoka 2018.08 6
ΤʔδΣϯτϨεʹίʔ υͰߏཧ͢Δπʔϧ 2018/8/3 Ansible Night in Fukuoka 2018.08 7
ͳͥAnsibleΛ͍࢝Ί͔ͨʁ! 2018/8/3 Ansible Night in Fukuoka 2018.08 8
࡞ͷґཔΛड͚Δ 2018/8/3 Ansible Night in Fukuoka 2018.08 9
ࢁͷ࡞ͷґཔΛड͚Δ 2018/8/3 Ansible Night in Fukuoka 2018.08 10
• Ҋ݅͝ͱͷαʔόʔ • ։ൃɺຊ൪༻ • ෳߏங • ΫϥυʹΑΔαʔόʔͷ͍ࣺͯ • ӡ༻
͜Εશ෦1ਓͰɾɾɾʁ 2018/8/3 Ansible Night in Fukuoka 2018.08 11
Ͳ͏ͬͯࡹ͘ʁ 2018/8/3 Ansible Night in Fukuoka 2018.08 12
!ؒΛݺͿ ͔͠͠ɺॿ͚ɾɾɾ! 2018/8/3 Ansible Night in Fukuoka 2018.08 13
͕࣌ؒΜΔ 2018/8/3 Ansible Night in Fukuoka 2018.08 14
#͍͍͑ 2018/8/3 Ansible Night in Fukuoka 2018.08 15
Infrastructure as Code 2018/8/3 Ansible Night in Fukuoka 2018.08 16
ʊਓਓਓਓਓਓਓʊ ʼɹಇ͖ํվֵɹʻ ʉY^Y^Y^Y^Y^Yʉ 2018/8/3 Ansible Night in Fukuoka 2018.08 17
ߏཧπʔϧͳ͠ • खॱॻΛݩʹखಈͰઃఆ • खಈΦϖϛεͷՄೳੑ • खॱॻຊʹ࠷৽ʁ • ࢼ͞ΕΔهԱྗ •
ൿͷλϨ 2018/8/3 Ansible Night in Fukuoka 2018.08 18
ߏཧπʔϧ͋Γ • खॱΛίʔυͰهड़ • ίʔυΛ࣮ߦͯࣗ͠ಈͰઃఆ • ୭Ͱ࣮ߦͰ͖Δ • ίʔυ͕࠷৽ͷঢ়ଶ •
όʔδϣϯཧ(Git)ͯ͠ɺҎલͷঢ়ଶʹ͢ͷ؆୯ • Կ࣮ߦͯ͠ಉ͡ঢ়ଶʢႈੑʣ 2018/8/3 Ansible Night in Fukuoka 2018.08 19
͞Βʹ 2018/8/3 Ansible Night in Fukuoka 2018.08 20
ίʔυڞ௨Խ (Ansible Role) • ͍ͭΠϯετʔϧ(sysstat, git) • ֤छϛυϧΣΞ(Apache, MySQL) •
ΫϥυʹԠͨ͡ઃఆ(ϝϞϦΩϟογϡ) ͑͏΄ͲRoleࢿ࢈͕૿͑Δ 2018/8/3 Ansible Night in Fukuoka 2018.08 21
Let's Ansible 2018/8/3 Ansible Night in Fukuoka 2018.08 22
࠷ݶඞཁͳ • Python • AnsibleίϚϯυ • inventory • module •
playbook 2018/8/3 Ansible Night in Fukuoka 2018.08 23
AnsibleίϚϯυ Πϯετʔϧ $ pip install ansible 2018/8/3 Ansible Night in
Fukuoka 2018.08 24
inventory ࡞ۀରͱͳΔϗετΛهड़͢ΔϑΝΠϧ [web] 192.168.0.10 [db] 192.168.0.20 2018/8/3 Ansible Night in
Fukuoka 2018.08 25
module ΠϯετʔϧαʔϏεىಈͳͲίϚϯυͷ෦ • yum • service $ ansible -i hosts
web -m ping 192.168.0.10 | success >> { "changed": false, "ping": "pong" } 2018/8/3 Ansible Night in Fukuoka 2018.08 26
playbook ϞδϡʔϧΛ࣮࣮ͯ͠ߦ͢Δ෦ - hosts: web sudo: yes tasks: - name:
be sure httpd is installed yum: name=httpd state=installed - name: be sure httpd is running and enabled service: name=httpd state=running enabled=yes 2018/8/3 Ansible Night in Fukuoka 2018.08 27
playbook࣮ߦ $ ansible-playbook -i hosts simple.yml PLAY [web] ************************************************************ GATHERING
FACTS *************************************************************** ok: [192.168.0.10] TASK: [be sure httpd is installed] ******************************************** changed: [192.168.0.10] TASK: [be sure httpd is running and enabled] ********************************** changed: [192.168.0.10] PLAY RECAP ******************************************************************** 192.168.0.10 : ok=3 changed=2 unreachable=0 failed=0 2018/8/3 Ansible Night in Fukuoka 2018.08 28
ଞʹ • Ϋϥυ • Vagrant • Windows • git •
ωοτϫʔΫػث ͳͲͳͲ 2018/8/3 Ansible Night in Fukuoka 2018.08 29
AnsibleΛಋೖ͍ͯ͠ΔՕॴ • αʔόʔϓϩϏδϣχϯά • ΞϓϦέʔγϣϯσϓϩΠ Ϋϥυ෦AWS CloudFormationAzure ARM Templateɺ TerraformΛ͍ͬͯ·͢ɻ
2018/8/3 Ansible Night in Fukuoka 2018.08 30
Ansibleͷӡ༻ 2018/8/3 Ansible Night in Fukuoka 2018.08 31
ಈ࡞ڥ 2018/8/3 Ansible Night in Fukuoka 2018.08 32
Πϯετʔϧ؆୯ • yum install ansible • apt-get install ansible •
pip install ansible ͓Έͷํ๏Ͱ 2018/8/3 Ansible Night in Fukuoka 2018.08 33
όʔδϣϯͷΈ߹Θͤ • Python 2 (versions 2.6 or 2.7) • Python
3 (versions 3.5 and higher) • Ansible 1.x or 2.x • Playbook࡞࣌ͷAnsibleόʔδϣϯ 2018/8/3 Ansible Night in Fukuoka 2018.08 34
Ansibleઐ༻ಈ࡞ڥ͕͋Δ • ܧଓతʹϓϩϏδϣϯΠϯά͢ΔͨΊͷڥ͕͋Δ • όʔδϣϯݻఆ or ߹ΘͤΒΕΔ • Not ࠷৽͔͠Εͳ͍͕ಈ͘ʹࠔΒͳ͍
!όʔδϣϯճආͰ͖ͦ͏ 2018/8/3 Ansible Night in Fukuoka 2018.08 35
Ansibleಈ࡞ڥ͕ͳ͍ • ଞਓʹ࣮ߦͯ͠Β͍͍͚ͨͲಈ࡞ڥʁ • ୯ൃͷҊ݅ • ίϚϯυΞοϓσʔτޙͷPlaybookಈ͘ʁʢޙํޓʣ 2018/8/3 Ansible Night
in Fukuoka 2018.08 36
͍ͨ͜͠ͱ • ڥґଘ͔Βͷղ์ • ϙʔλϏϦςΟ 2018/8/3 Ansible Night in Fukuoka
2018.08 37
ίϯςφͰղܾͰ͖ͦ͏ 2018/8/3 Ansible Night in Fukuoka 2018.08 38
Docker • Dockerfile FROM python:3.6-onbuild CMD [ "ansible", "--version" ]
• requirements.txt ansible>=2.5.0,<2.6.0 • Docker Build docker build -t local/ansible:2.5 . 2018/8/3 Ansible Night in Fukuoka 2018.08 39
docker run $ docker run -it --rm \ -v $HOME/.ssh:/root/.ssh:ro
\ -v $PWD:/playbooks \ -w /playbooks \ hawaku/ansible:2.5 \ bash root@29867ac2540f:/playbooks# ansible -i hosts all -m ping 2018/8/3 Ansible Night in Fukuoka 2018.08 40
alias alias ansible_2.5='docker run -it --rm \ -v $HOME/.ssh:/root/.ssh:ro \
-v $PWD:/playbooks \ -w /playbooks \ hawaku/ansible:2.5 \ bash' $ ansible_2.5 root@29867ac2540f:/playbooks# ansible -i hosts all -m ping 2018/8/3 Ansible Night in Fukuoka 2018.08 41
͘͠ playbook ├── site.yml ├── Dockerfile ├── requirements.txt ├── inventories
└── roles PlaybookʹDockerfileஔ͍ͱ͘ 2018/8/3 Ansible Night in Fukuoka 2018.08 42
·ͱΊ 2018/8/3 Ansible Night in Fukuoka 2018.08 43
AnsibleಋೖͷޮՌ • Πϯϑϥͷߏஙʹֻ͕͔࣌ؒΔ • !ࣗಈԽͰߏங࣌ؒͷॖɾۭ͖࣌ؒ༗ޮ׆༻ • !ઃఆ࿙Εɾϛε͕ͳ࣭͕҆͘ఆ • ΠϯϑϥΤϯδχΞෆࡏͰͷΞϓϦέʔγϣϯσϓϩΠ 2018/8/3
Ansible Night in Fukuoka 2018.08 44
ఆ࣌ୀࣾ2 2 http://redhat.lookbookhq.com/jpansiblecomic 2018/8/3 Ansible Night in Fukuoka 2018.08 45
͓·͚ 2018/8/3 Ansible Night in Fukuoka 2018.08 46
ࠇ͍ը໘͖Ͱ͢ΑͶʁ 2018/8/3 Ansible Night in Fukuoka 2018.08 47
AWX 2018/8/3 Ansible Night in Fukuoka 2018.08 48
AWXͰͰ͖Δ͜ͱ • AnsibleίϚϯυͷGUI൛ • Ϣʔβʔೝূ • ϩʔϧཧ • ࣮ߦཤྺ •
Rest API ͳͲͳͲ 2018/8/3 Ansible Night in Fukuoka 2018.08 49
Azure Cloud Shell ϒϥβͰαʔόʔϨεͰAnsibleಈ͖·͢ 2018/8/3 Ansible Night in Fukuoka 2018.08
50
Azure × Ansible 2018/8/3 Ansible Night in Fukuoka 2018.08 51
͓ΘΓ 2018/8/3 Ansible Night in Fukuoka 2018.08 52