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学習ベストプラクティス/ansible_for_beginners
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
hiromaaa03
April 17, 2019
Technology
1.5k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
俺流!!Ansible学習ベストプラクティス/ansible_for_beginners
2019/04/17 Ansible Night LT資料です
hiromaaa03
April 17, 2019
More Decks by hiromaaa03
See All by hiromaaa03
Infrastudy6
hiromaaa03
0
1.1k
CloudOperationsandTipsforNextGenerationMSPs
hiromaaa03
1
240
Other Decks in Technology
See All in Technology
局所最適は悪ではない。壊れているのは指標です。量と質を同時に見る先行指標の設計
recruitengineers
PRO
2
430
【データ横丁主催】AI エージェント時代のTranslytical Data Platform
shisyu_gaku
0
250
Let's Change Our World—Again
snoozer05
PRO
5
360
Claude Code on Bedrock で統制をかける小ネタ集/claude-code-bedrock-governance-tips
emiki
1
410
DBについての基礎説明(MySQL編) - コロプラ 2026年度 新卒研修
colopl
0
160
トークン化預金DCJPYの取り組みと活用ユースケース
finengine
0
230
[EMNLP26] RIGEL: Self-Distilled Score Adaptation for Image and Video Captioning Evaluation
keio_smilab
PRO
0
120
「エーアイ」をバズワードにしないために RPA 導入経験と Kiro 上での Claude モデル利用経験から
kazzpapa3
0
120
OptunaHub: ブラックボックス最適化のためのプラットフォーム
pfn
PRO
0
150
20年間 SNS サービス「GREE」 を支えた技術の刷新と、長期運用サービスの Kubernetes へのリアーキテクト
gree_tech
PRO
0
110
Metadata - Section 2: Simple Metadata & Meta Tags
mohab1
0
120
AWSDirectConnectの構築の進め方を整理してみた
masa_my
1
150
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
GitHub's CSS Performance
jonrohan
1033
470k
How to train your dragon (web standard)
notwaldorf
96
6.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Product Roadmaps are Hard
iamctodd
55
13k
Six Lessons from altMBA
skipperchong
29
4.5k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
A Tale of Four Properties
chriscoyier
163
24k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Done Done
chrislema
187
17k
Transcript
AXLBIT Inc. 0 俺流!! Ansible学習ベストプラクティス @hiromaaa03
AXLBIT Inc. 1 自己紹介 • 竹西 宏真(@hiromaaa03) • AXLBIT株式会社 •
ソリューション部 • インフラエンジニア • 趣味:バスケットボール、お酒 • コミュニティ活動:YOUTH TECH (@youthtechtokyo)
AXLBIT Inc. 2 やってること
AXLBIT Inc. 3 Built by 環境構築やってます。
AXLBIT Inc. 4 Released by リリースやってます。
AXLBIT Inc. 5 いま、おそらく社内で一番Playbookかいてます。
AXLBIT Inc. 6 もともと
AXLBIT Inc. 7 Ansible… なにそれ おいしいの?
AXLBIT Inc. 8 俺流!! 右も左もわからない新卒が実践した Ansible学習ベストプラクティス
AXLBIT Inc. 9 前提として • 自由につくってこわせる実行環境の用意 • Ansibleベストプラクティスを意識したシンプルなPlaybookの用意 https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#directory-layout https://github.com/ansible/ansible-examples/tree/master/lamp_simple
AXLBIT Inc. 10 では本題
AXLBIT Inc. 11 といっても
AXLBIT Inc. 12 4つのSTEPを繰り返すだけ
AXLBIT Inc. 13 STEP 1 魔法のansible-playbookコマンド
AXLBIT Inc. 14 STEP 2 手動での環境構築
AXLBIT Inc. 15 STEP 3 手順書の作成
AXLBIT Inc. 16 STEP 4 Playbookの作成
AXLBIT Inc. 17 Playbook理解への道のり
AXLBIT Inc. 18 Inventory • 対象ホストをグループに分けてホスト制御を確認 • インベントリファイルになるべくvars(変数)を記述しない ※好みの問題だと思ってます。僕はなるべくvarsの記述場所を統一したい派
AXLBIT Inc. 19 group_vars • まずvars(変数)の定義はgroup_varsのみで確認 – なれてきたらinventoryやhost_vars,extra_varsをつかってみる! – 内容をリスト定義してみたりするとよりgood!!
• 優先順位を意識する https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html > 優先度:高 優先度:低 高 低
AXLBIT Inc. 20 task • taskには必ずnameをつける! • shellモジュールやcommandモジュールの使用を控える • 頻出モジュールを調査する(yum,template,files
などなど…) • 個人的には”when”による条件分岐にはやく慣れる https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#the-when-statement
AXLBIT Inc. 21 filesとtemplates(設定ファイルの送付) • filesとtemplatesの違いを認識する – 送付するファイルに変数を使用しない場合、rolesディレクトリ内files配下に ファイルを格納し、copyモジュールを使用 –
送付するファイルに変数を使用する場合 、rolesディレクトリ内templates配下に ファイルを格納し、templateモジュールを使用 ※ チームでPlaybookを編集する場合など、filesとtemplatesの構成を理解せずに Playbookの編集をすると上記をごちゃごちゃに配置する人が出てくる恐れがあるので チームへの周知もかねて徹底しましょう!! (ちなみに実際にありました。。。)
AXLBIT Inc. 22 jinja2 • 便利!!だから使おう!!! https://docs.ansible.com/ansible/latest/user_guide/playbooks_templating.html http://jinja.pocoo.org/docs/2.10/ • Templateで設定ファイルを送付するときに柔軟な設定が可能
– 設定ファイル内でif分岐やforによるループ処理、varsに格納している変数の反映など • taskでも使用可能。 – 取得したvarsの配列からフィルターをかけて対象の要素のみを取り出せる – whenの判定にも使用可能など ※Jinja2テンプレート自体のバージョンによって使えるフィルターなどに違いがあるので注意
AXLBIT Inc. 23 ありがとうございました。
AXLBIT Inc. 24 AXLBITブログ立ち上げようとしてます。 まだ準備中なのでミラーサイトですが、Ansibleの多重ループについて記事を書きました。 良ければ、ご覧ください!! https://blog.axltest.biz/?p=40
AXLBIT Inc. 25 Accelerate your Business with IT