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入門
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
airhand
February 27, 2018
Technology
260
0
Share
ansible入門
ansibleの概要説明とサンプルリポジトリのリンク
airhand
February 27, 2018
More Decks by airhand
See All by airhand
JS Framework入門(2018)
airhand
0
78
Docker 入門
airhand
0
99
Other Decks in Technology
See All in Technology
Podcast配信で広がったアウトプットの輪~70人と音声発信してきた7年間~/outputconf_01
fortegp05
0
130
SaaSに宿る21g
kanyamaguc
2
180
The essence of decision-making lies in primary data
kaminashi
0
190
OCI技術資料 : ロード・バランサ 概要 - FLB・NLB共通
ocise
4
27k
Blue/Green Deployment を用いた PostgreSQL のメジャーバージョンアップ
kkato1
0
170
DMBOKを使ってレバレジーズのデータマネジメントを評価した
leveragestech
0
490
20260326_AIDD事例紹介_ULSC.pdf
findy_eventslides
0
250
AI時代のオンプレ-クラウドキャリアチェンジ考
yuu0w0yuu
0
670
第26回FA設備技術勉強会 - Claude/Claude_codeでデータ分析 -
happysamurai294
0
110
Kiro Meetup #7 Kiro アップデート (2025/12/15〜2026/3/20)
katzueno
2
270
JEDAI認定プログラム JEDAI Order 2026 受賞者一覧 / JEDAI Order 2026 Winners
databricksjapan
0
410
PostgreSQL 18のNOT ENFORCEDな制約とDEFERRABLEの関係
yahonda
0
150
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1032
470k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
53k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
500
WCS-LA-2024
lcolladotor
0
500
Mind Mapping
helmedeiros
PRO
1
140
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Ethics towards AI in product and experience design
skipperchong
2
240
The SEO Collaboration Effect
kristinabergwall1
0
410
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
310
Transcript
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