-1

Summary: I'm trying to install Ansible on an Ubuntu 14.x server.

I'm trying to follow these steps: http://docs.ansible.com/intro_installation.html

I have a problem with this command when I issued it as root:

# ansible all -m ping --ask-pass -vvvv

(I added the -vvvv for verbose debugging information.)

Here is what I see:

SSH password:
<127.0.0.1> ESTABLISH CONNECTION FOR USER: root
<127.0.0.1> REMOTE_MODULE ping
<127.0.0.1> EXEC ['sshpass', '-d6', 'ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'ConnectTimeout=10', '127.0.0.1', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1430936987.71-278505449931727 && echo $HOME/.ansible/tmp/ansible-tmp-1430936987.71-278505449931727'"]
127.0.0.1 | FAILED => SSH encountered an unknown error. The output was:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/root/.ansible/cp/ansible-ssh-127.0.0.1-22-root" does not exist
debug2: ssh_connect: needpriv 0
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug3: timeout: 9996 ms remain after connect
debug1: permanently_set_uid: 0/0
debug3: Incorrect RSA1 identifier
debug3: Could not load "/root/.ssh/id_rsa" as a RSA1 public key

What did I do wrong? I tried creating ssh-keys. It didn't help.

PJ8912
  • 113
  • 3
  • 1
    Your issue might be that you are running as root. Most systems don't let root ssh in. Try connecting as not root – grag42 May 06 '15 at 22:41
  • Pretty much any answer to an SSH issue can be found in the logs on the server side. Look there. (Also, as several people have already said, ***don't ssh as root!*** – Jenny D May 07 '15 at 08:00

1 Answers1

1

Don't run ansible as root, as grag42 pointed out.

Ensure you can ssh to whatever hosts you want to manage with ansible without having to enter a password or passphrase, i.e. use ssh keys and a key agent (or keys without a passphrase; not recommended).

Ensure that the user you use to run ansible has full sudo rights on the target hosts, without having to enter a password.

wurtel
  • 3,864
  • 12
  • 15