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
240
勝手にAlibaba Cloud White Beltシリーズ Elastic Compute Service(ECS)/alieaters-20190301
morita92hiro
0
390
希望のRancher〜コンテナをアウフヘーベン〜/ranchermeetup-20171006
morita92hiro
0
270
いまからDockerで始めるGitLab CE/gitlabjp-20170919
morita92hiro
1
1.3k
月額10円から作るServerless Website〜Azure編〜/serverlessfukuoka-20170825
morita92hiro
8
16k
コンテナ運用いきのこるには/ranchermeetup-20170807
morita92hiro
1
560
AWS Summit Tokyoをお探しですか?/jawsug-20170713
morita92hiro
0
160
ブラウザだけでインフラ操作?〜これさえあれば、何もいらない。〜/fukuazu-20170622
morita92hiro
1
890
Other Decks in Technology
See All in Technology
小規模に始めるデータメッシュとデータガバナンスの実践
kimujun
3
550
Product Engineer Night #6プロダクトエンジニアを育む仕組み・施策
hacomono
PRO
1
440
「最高のチューニング」をしないために / hack@delta 24.10
fujiwara3
20
3.3k
Gradle: The Build System That Loves To Hate You
aurimas
2
140
Figma Dev Modeで進化するデザインとエンジニアリングの協働 / figma-with-engineering
cyberagentdevelopers
PRO
1
420
話題のGraphRAG、その可能性と課題を理解する
hide212131
4
1.4k
新卒1年目が向き合う生成AI事業の開発を加速させる技術選定 / ai-web-launcher
cyberagentdevelopers
PRO
7
1.5k
LLMアプリをRagasで評価して、Langfuseで可視化しよう!
minorun365
PRO
3
300
【LT】ソフトウェア産業は進化しているのか? -Javaの想い出とともに- #jjug_ccc
takabow
0
170
コンテンツを支える 若手ゲームクリエイターの アートディレクションの事例紹介 / cagamefi-game
cyberagentdevelopers
PRO
1
110
分布で見る効果検証入門 / ai-distributional-effect
cyberagentdevelopers
PRO
4
690
VPC間の接続方法を整理してみた #自治体クラウド勉強会
non97
1
570
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
A designer walks into a library…
pauljervisheath
202
24k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Rails Girls Zürich Keynote
gr2m
93
13k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Building Adaptive Systems
keathley
38
2.2k
Unsuck your backbone
ammeep
668
57k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Why Our Code Smells
bkeepers
PRO
334
57k
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