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 + GitLab で楽に何度もデプロイする話 #ゆるWeb札幌
Search
Kihara, Takuya
PRO
February 15, 2020
Technology
2
490
Ansible + GitLab で楽に何度もデプロイする話 #ゆるWeb札幌
ゆるWeb勉強会@札幌 #8 (中止)
https://mild-web-sap.connpass.com/event/164107/
勉強会を中止にしたので、資料のみ。
Kihara, Takuya
PRO
February 15, 2020
Tweet
Share
More Decks by Kihara, Takuya
See All by Kihara, Takuya
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
390
Amplify Gen2 Deep Dive / How to convey backend types to the frontend #30DaysOfAmplify
tacck
PRO
0
5
TypeScript 雰囲気勢がライブラリのコードリーディングで得た知識 #sacss
tacck
PRO
1
30
ライブコーディングで知るAmplify Gen 2 #AWSAmplifyJP
tacck
PRO
1
120
AWS Amplify Gen 2 GA記念 ~Gen1との違いを確認
tacck
PRO
0
340
Amplify Gen2 が GA したよ! #jawsug_sapporo #jawsug
tacck
PRO
0
310
Flutter で "Hello World!! #ゆるWeb札幌
tacck
PRO
0
140
AWS Lambda で LLRT を動かしてみた #北海道まったりLT大会
tacck
PRO
0
140
地方から始める登壇のステップアップ 〜Java Do から JJUG CCC への登壇参加記録 #javado
tacck
PRO
0
190
Other Decks in Technology
See All in Technology
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
120
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
180
Terraform Stacks入門 #HashiTalks
msato
0
360
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
TypeScript、上達の瞬間
sadnessojisan
46
13k
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
170
『Firebase Dynamic Links終了に備える』 FlutterアプリでのAdjust導入とDeeplink最適化
techiro
0
110
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
300
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
Featured
See All Featured
Become a Pro
speakerdeck
PRO
25
5k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
GraphQLとの向き合い方2022年版
quramy
43
13k
It's Worth the Effort
3n
183
27k
Ruby is Unlike a Banana
tanoku
97
11k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
97
Embracing the Ebb and Flow
colly
84
4.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Transcript
גࣜձࣾϊʔεσΟςʔϧ ։ൃ%JWJTJPOٕज़ਪਐ(SPVQ UBDDLݪ !UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ "OTJCMF (JU-BCͰ ָʹԿσϓϩΠ͢Δ ݄
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • ໊લ ݪ / @tacck •
ॴଐ גࣜձࣾϊʔεσΟςʔϧ ։ൃDivision ٕज़ਪਐGroup / Leader • ओ࠵ • ΏΔWebษڧձ@ࡳຈ • εϚʔτεϐʔΧʔͰ༡΅͏ձ@ࡳຈ • ͖ͳϑΟΪϡΞεέʔτͷٕ εϓϨουɾΠʔάϧ ୭ PHP Conference Hokkaido 2019
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • Ansible • GitLab CI/CD • ࿈ܞͯ͠ԿΛ͔ͬͨ
ࠓ͢͜ͱ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ ͦͦ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • ࣾͷҊ݅ͰɺαʔόʔҠ͕ඞཁͩͬͨɻ • খنͷอक • ͋Δاۀ͚εϚʔτϑΥϯΞϓϦͷ ༻αʔό
(ΦϯϓϨ) • ࣾͷϚγϯཧʹ͍ɺAWS Lightsail Ҡɻ • ϑΝΠϧͷஔɺ֬ೝ߲ͳͲ͢Ͱʹݻ·͍ͬͯΔͷͰɺ εϜʔζʹ࡞ۀ͢ΔͨΊɻ ͦͦ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • Ҋ݅ಛ༗ͷߏͳͲɺʮҰճʯΕجຊऴΘΓɻ → ࣗಈԽͳͲ͢ΔίετΛ͑ͳ͍ɻ • ͱݴ͍ͭͭɺ͜͏͍͏খنҊ݅ ʮ୲ऀʯͷೖΕସΘΓ͕ൃੜ͍͢͠ɻ
(ͦͷ࣌ʹରԠͰ͖Δਓ͕ରԠ͢ΔɺɺͳͲɻ) ͱ͍͑
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • Ansible ʹΑΔΠϯϑϥͷίʔυԽ (IaaC) • GitLab CI/CD
ʹΑΔσϓϩΠͷࣗಈԽ (DevOps) • ࠓޙΛݟਾ͓͖͔͑ͯͬͯͨͬͨɻ • ίʔυԽ͓ͯ͘͠ͱࣾͷݟల։͍͢͠ͷͰɺ ৭ʑͱʹཱͭɻ ͦͷͨΊ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ "OTJCMFͱ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ "OTJCMF https://www.ansible.com/
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ "OTJCMFͷಛ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • Python • ΤʔδΣϯτϨε • ૢ࡞ରʹɺಛผͳԿ͔ΛೖΕͳͯ͘ྑ͍ɻ
( SSH ͱ Python ͕͋Εྑ͍ɻ) • YAML • ઃఆYAMLͰهड़Մೳɻ • ઃఆͷه๏ͦͷͷͷशಘқ͍ɻ (͍͍ͨػೳ͝ͱʹ֮͑Δ͜ͱɺͪΖΜ͋Γ·͢ɻ) "OTJCMFͷಛ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • Ϟδϡʔϧ • ϞδϡʔϧํࣜͰɺػೳ֦ு͞Ε͍ͯΔɻ • ඞཁͳΒɺࣗͰ࡞Մೳɻ •
ຊମ Python ͕ͩɺ Ϟδϡʔϧ Python ͡Όͳͯ͘OKɻ "OTJCMFͷಛ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • ႈੑ • ʮԿ࣮ߦͯ͠ಉ͡ঢ়ଶʹͳΔʯ͜ͱΛαϙʔτɻ • ͨͩ͠ɺϞδϡʔϧͷ࣮࣍ୈɻ •
ϑΝΠϧஔαʔϏεΠϯετʔϧͱ͍ͬͨͷɺ جຊతʹαϙʔτ͞Ε͍ͯΔɻ • ʮίϚϯυ࣮ߦʯܥͷϞδϡʔϧɺ αϙʔτ͞Ε͍ͯͳ͍Մೳੑ͕͋ΔͷͰҙɻ (Ansible ͔ΒݟͯอূͰ͖ͳ͍ͷͰɻ) "OTJCMFͷಛ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ "OTJCMFͷྺ࢙
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • 2012ʹ “Ansible, Inc.” ͕։ൃ։࢝ɻ • 2013ʹ
ࢲ͍࢝Ίͨ (Β͍͠) ɻ https://qiita.com/tacck/items/e3669b94e6a8066ce642 • ͜ͷ࣌ظߏཧπʔϧͷོظɻ • “Chef” ͕ڧ͔ͬͨهԱɻ (Ruby) • 2015ʹ Red Hat ࣾʹΑΓങऩɻ • ͪͳΈʹɺ Red Hat ࣾ 2018ʹ IBM ࣾʹΑΓങऩɻ "OTJCMFͷྺ࢙
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ "OTJCMFઃఆͷجຊ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • ରͱͳΔϗετͷใ (Inventory) • INIܗࣜ or YAMLܗࣜ
(ൺֱత࠷ۙରԠ͞Εͨ) • աڈͷใΛάάΔͱɺINIܗࣜͷใ͕ͨ͘͞Μɻ • ૢ࡞༰ (Playbook) • ػೳ୯ҐͰׂ͢Δ Roles ܗࣜͰॻ͘ͷ͕Ұൠతɻ "OTJCMFઃఆͷجຊ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ *OWFOUPSZ [web] 192.168.100.1 [web:vars] ansible_port=22 ansible_user=centos ansible_ssh_private_key_file=hosts/testing/web_testing.pem
[all:vars] stage=testing
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ 1MBZCPPL NBJOZNM --- - hosts: all become:
yes vars_files: - "vars/{{ stage }}.yml" roles: - setups - file_upload
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ 1MBZCPPL SPMFTTFUVQTUBTLTNBJOZNM --- - name: set timezon
Asia/Tokyo shell: timedatectl set-timezone Asia/Tokyo - name: install httpd yum: name: httpd state: latest - name: enable httpd systemd: name: httpd enabled: yes - name: restart httpd systemd: name: httpd state: restarted
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ 1MBZCPPL SPMFTpMF@VQMPBEUBTLTNBJOZNM --- - name: upload index.html
file template: src: index.html.j2 dest: "/var/www/html/index.html"
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ (JU-BC$*$%ͱ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • GitHub Έ͍ͨͳ Git Repository αʔϏεɻ •
ͦͷதͷػೳͱͯ͠ɺ “CI/CD” ͕͋Δɻ • ϦϙδτϦʹ͋ΔίʔυΛͬͯɺ ৭ʑ͍͍ͬͯΑ! ͱ͍͏αʔϏεɻ (JU-BC
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • ઃఆΛ YAML Ͱهड़ɻ • ίʔυͷνΣοΫɺϑϩϯτΤϯυͷϏϧυɺ αʔόʔͷσϓϩΠͳͲͳͲΛهड़Մೳɻ
• ઃఆهड़ޙɺ git push ͢ΔͨͼʹࣗಈͰ࣮ߦ͞ΕΔɻ • खಈͰͷ࣮ߦɾ࠶࣮ߦՄೳɻ (JU-BC$*$%
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ (JU-BC$*$% HJUMBCDJZNMൈਮ stages: - deploy - testing
.deploy_job: &deploy_job stage: deploy image: cytopia/ansible:2.9-tools script: - ansible-playbook -i hosts/${APP_ENV}/inventory main.yml deploy testing: <<: *deploy_job variables: APP_ENV: testing before_script: - chmod 755 . - cat $SSH_KEY_PEM > hosts/testing/web_testing.pem - chmod 600 hosts/testing/web_testing.pem
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ σϞ -JHIUTBJMͰαʔό४උ *OWFOUPSZʹ*1ࢦఆ (JU-BC$*$%ͰσϓϩΠ IUUQTHJUIVCDPNUBDDLTBNQMFBOTJCMFNJMEXFCTBQ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ ·ͱΊ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • Ansible ΛͬͯΠϯϑϥ (αʔόͷߏ) ΛίʔυԽɻ • ίʔυʹͳ͍ͬͯΕɺσϓϩΠࣗಈԽՄೳɻ
(GitLab CI/CD) • σϓϩΠࣗಈԽ͞Ε͍ͯΕɺ ͙͢ʹ҆ఆͨ͠ڥΛखʹೖΕΒΕΔ!! • ςετͩͬͯॻ͚ͪΌ͏!!! • ಈ͘ͷΛఏࣔͰ͖ΔͷͰɺਓʹ͍͑͢ɻ ·ͱΊ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ FOE
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ ࡳຈͷΠϯϑϥɾΫϥυܥ ษڧձͷҊ ൺֱత׆ಈ͍ͯ͠Δͷ ࢲ͕ิͰ͖ͨͷ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • https://jawsug-sapporo.doorkeeper.jp/events/102248 • ࡾʙ࢛ϲ݄ʹҰճఔ • ࣍ճ: 20202݄21(ۚ)
+"846(ࡳຈ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • https://sapporo-aws.connpass.com/event/163725/ • ࡾʙ࢛ϲ݄ʹҰճఔ 4BQQPSPBXT
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • https://sapporoazuremok2.connpass.com/event/154302/ • ຖ݄Ұճ • ࣍ճ: 20202݄22
() ࡳຈ"[VSF͘͘ձ
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • https://sapporo-beginner-kubernetes.connpass.com/event/ 161411/ • ࡾϲ݄ʹҰճఔ ,VCFSOFUFT4BQQPSPGPS#FHJOOFST
!UBDDL ΏΔ8FCษڧձ!ࡳຈ ΏΔ8FCࡳຈ • https://ansible-users.connpass.com/event/159174/ • ·ͩҰճͰ͕͢ɺࠓճͬͨͷͰɻ • ࢲࢀՃͯ͠LT͠·ͨ͠ɻ "OTJCMF͘͘ձ
αʔόฤ JOࡳຈ