6
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ansibleインストールしてとりあえず疎通確認を試した

Last updated at Posted at 2018-09-11

インストール

sudo apt-get install ansible

対抗ノードのIP記載

inventory/hosts
[primary]
10.0.0.1

疎通確認してみる

ansible all -i inventory/hosts -m ping
10.0.0.1 | UNREACHABLE! => {
    "changed": false,
    "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue",
    "unreachable": true
}

残念!

Ansibleの挙動を調べてみると
rootユーザで対抗ノードにSSHしてからpingコマンドを実行しているらしい
→ 改めて確認するとrootではなく実行元ログインユーザだった
・特に指定がなければ鍵認証でSSHするらしい

SSHユーザの指定

inventory/hosts
[primary]
10.0.0.1 ansible_ssh_user=hogehoge

オプション指定でパスワード入力

ansible all -i inventory/hosts -m ping --ask-pass
10.0.0.1 | FAILED! => {
    "failed": true,
    "msg": "ERROR! to use the 'ssh' connection type with passwords, you must install the sshpass program"
}

インストールします...

sudo apt-get install sshpass

再実施

ansible all -i inventory/hosts -m ping --ask-pass
10.0.0.1 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

ようやくAnsibleの疎通確認ができた...

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?