LoginSignup
2
0

More than 5 years have passed since last update.

WIP:Ansibleで勉強会用の環境を構築する方法備忘録

Last updated at Posted at 2018-02-26

勉強会を開催するにあたってどうしても事前の環境構築などが必要になり、ansibleを使ってみようと。

どこぞの環境に接続して実行するわけではなくローカルでの実行を前提にしています。

モジュールについて

ansibleでは各モジュールというものが提供されているらしい

例えばpostgresqlを扱うためのpostgresql_dbモジュールなど

ダウンタイムについて

taskで再起動する場合は当然ながらダウンタイムがある

自分自身を指定する方

オプションで--connection=localを指定する

$ ansible-playbook --connection=local main.yml

sudoが必要なtaskを実行する方法

  • becomeを記述する。sudoは非推奨になったらしいので使わない
  • オプションに--ask-become-passを使うとパスワードをきいてくる。事前に登録することもできるらしく理想的だけど暗号化とかめんどくさそうなのでとりあえず今回はこれで
main.yml
---
- hosts: localhost
  become: yes
$ ansible-playbook main.yml --connection=local --ask-become-pass

参考にしたWebページ

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0