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入門
Search
airhand
February 27, 2018
Technology
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ansible入門
ansibleの概要説明とサンプルリポジトリのリンク
airhand
February 27, 2018
Transcript
13 slides
Ansible 構成管理ツール やり方次第でデプロイも可能 冪等性を持つ (一部モジュールを除く)
冪等性とは 数学において、冪等性(べきとうせい、英: idempotence 「巾等性」とも書くが読み方は同じ) は、 大雑把に言って、ある操作を1回行っ ても複数回行っても結果が同じである ことをいう概念である。 Wikipediaより
競合ツール
競合ツールとの違い プッシュ型でsshで接続するので、ノードにパッケ ージをインストールする必要がほぼない (Pythonが あればOK) YAMLを使うので比較的シンプル。Rubyを覚える 必要がなく、linuxコマンドがわかっていれば大体 読める(はず)
今までは... Load Balancer Web Server DB Server haproxy nginx httpd
MariaDB PostgreSQL 構成管理者 毎回手作業 手順が増えるたびにメモ ノードが増えると地獄 簡単なものはスクリプトにできるが、要求が増えるとメンテが大変
ansibleを導入すると... ansible Load Balancer Web Server DB Server Playbooks (YAML)
haproxy nginx httpd MariaDB PostgreSQL 構成管理者 playbookをバージョン管理 各ノードにsshでつなげるようにしておく 環境構築はコマンドを打つだけ ssh ssh ssh
nginx インストール & サービス開始 --- - hosts: web-servers tasks: -
name: install nginx yum: name: nginx state: installed - name: start nginx.service systemd: name: nginx state: started enabled: yes
基本はYAMLを書くだけ
学習コストを抑えられる
設定ファイルをテンプレートから生成 --- - hosts: web-servers tasks: - name: setup nginx
xxx.conf template: src: xxx.conf.j2 dest: /etc/nginx/conf.d/xxx.conf notify: restart nginx # 変更があれば再起動 - meta: flush_handlers handlers: - name: restart nginx systemd: name: nginix state: restarted
テンプレートの中身 jinja2 というテンプレートライブラリを利用 $ cat xxx.conf.j2 server { {# IPアドレス等をハードコードせずに変数で設定できる
#} server_name {{ hostvars[inventory_hostname]['ansible_eth ↓↓↓ $ cat /etc/nginx/conf.d/xxx.conf server { server_name 192.168.33.30;
実際は以下のような構成で運用 ├── ansible.cfg ├── inventories │ └── sample │ └──
hosts ├── playbooks │ ├── common.yml │ ├── db-servers.yml │ ├── roles │ │ ├── common │ │ ├── mariadb │ │ ├── nginx # roleそれぞれでtasks、handlersを管理 │ │ │ ├── handlers │ │ │ ├── tasks │ │ │ └── templates │ │ └── php │ └── web-servers.yml # web-server向けのroleをインポート ├── site.yml # roleをまとめたymlをさらにまとめる └── ssh_config
sample https://bitbucket.org/rshimada/ansible-tutorial
More Decks by airhand
See All by airhand
JS Framework入門(2018)
airhand
0
86
Docker 入門
airhand
0
130
Other Decks in Technology
See All in Technology
コーディングできない僕にBobが舞い降りた
shumpei3
0
230
フルTypeScript × AI駆動開発で開発量が数倍に (JSConf JP 2026 スポンサーLT:NCDC株式会社)
keitaibaraki
0
680
AWS re:Invent 2026 FSI Pre-Event Networking Night
junjikoide
0
350
AIフレンドリーなGenerative UIをJSXで
uhyo
2
1k
対話 AI プラットフォーム「アイブリー」で実践する自然言語処理と事業開発
ivry_presentationmaterials
0
210
Kiro Enterprise Management: 管理者が 1 か所で決め、全員の Kiro に届ける
inariku
PRO
1
170
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
5
18k
想定外の利用がプロダクトの価値を広げる
lycorptech_jp
PRO
0
140
その修正で本当に速くなったのか? k6とOpenTelemetryで確かめる性能改善 / Performance review with k6 and OpenTelemetry
ymotongpoo
3
490
本の挿絵に困ったから挿絵メーカーを自作した
yoshimura_datam
1
130
IVRy における AI 時代のデータプロダクトと事業開発
ivry_presentationmaterials
0
140
Go でトランザクション、どう書いてますか?
knwoop
2
650
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
910
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
610
Ruling the World: When Life Gets Gamed
codingconduct
0
450
The Pragmatic Product Professional
lauravandoore
37
7.5k
A designer walks into a library…
pauljervisheath
211
25k
Claude Code のすすめ
schroneko
67
230k
エンジニアに許された特別な時間の終わり
watany
109
250k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
590
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Into the Great Unknown - MozCon
thekraken
41
2.8k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
Mobile First: as difficult as doing things right
swwweet
225
10k