LoginSignup
5
5

More than 5 years have passed since last update.

Ansibleメモ

Last updated at Posted at 2014-07-28

sshログインの際にパスワード認証を必要とする場合
ansible-playbookの実行時に-kオプション(--ask-pass)をつけるのを忘れるので、-kオプションなしでも対話式に入力出来るようにしたメモ

  • vars_promptを使って対話式に入力をする
site.yml
- hosts: all
  gather_facts: no
  remote_user: root
  sudo: False
  vars_prompt:
    - name: "ansible_ssh_pass"
      prompt: "Enter Root User Password"
      private: yes

  roles:
    - common

実行してみる。

実行結果
$ ansible-playbook -i stage site.yml
Enter Root User Password:

PLAY [all] ********************************************************************

TASK: [common | User add] 
- 以下省略 -

-kオプションなしに上手く動いた。

5
5
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
5
5