Dan8
(Dan)
April 12, 2012, 8:22pm
1
Debugging help?
ansible all -k -m ping
SSH password:
xsdsyb01 | FAILED => FAILED: Authentication failed.
However I can ssh easily to the server and the key is fine, see no
password promt
e93204@dhcp66238:~$ ssh xsdsyb01
Last login: Thu Apr 12 15:12:07 2012 from dhcp66105.swaco
(-bash) e93204@xsdsyb01 ~>
Also- when hosts contains loopback, everything seems to work...
e93204@dhcp66238:~$ echo "127.0.0.1" > ~/ansible_hosts
e93204@dhcp66238:~$ export ANSIBLE_HOSTS=~/ansible_hosts
e93204@dhcp66238:~$ ansible all -m ping --ask-pass
SSH password:
127.0.0.1 | success >> {
"ping": "pong"
}
If you don’t have a password prompt when logging in normally, you don’t have a need to use -k, and it will just use your keys.
-k (AKA --askpass) uses SSH by password.
-a and -s were taken, -k doesn’t stand for --key or anything like that
Debugging help?
ansible all -k -m ping
SSH password:
xsdsyb01 | FAILED => FAILED: Authentication failed.
^^^^ here you're logging in as root.
However I can ssh easily to the server and the key is fine, see no
password promt
e93204@dhcp66238:~$ ssh xsdsyb01
Last login: Thu Apr 12 15:12:07 2012 from dhcp66105.swaco
(-bash) e93204@xsdsyb01 ~>
^^^ here you're logging in as a user.
try:
ssh root@xsdsyb01
and see what works or doesn't work.
Also- when hosts contains loopback, everything seems to work...
e93204@dhcp66238:~$ echo "127.0.0.1" > ~/ansible_hosts
e93204@dhcp66238:~$ export ANSIBLE_HOSTS=~/ansible_hosts
e93204@dhcp66238:~$ ansible all -m ping --ask-pass
SSH password:
127.0.0.1 | success >> {
"ping": "pong"
}
that's a special case for localhost/127.0.0.1 only - and I believe that
is being added for explicit-request only, now.
Sfromm can comment on that
-sv
Good catch Seth.
To clarify, the default login for /usr/bin/ansible is root unless you specify “-u username”.
In playbooks, this is simply “user: username” instead.
Seth’s correct. Right now, ansible will implicitly use LocalConnection for localhost. There are some patches queued up for review that change this to an explicit option. This will be true for the CLI and for playbooks.
sf
Dan8
(Dan)
April 12, 2012, 11:35pm
6
That's exactly what I needed! Works now.
I misunderstood the "root permissions are not required to use it" on
the gettingstarted page, which preceded literal examples.
Also I believe the line on that pge:
cat "127.0.0.1" > ~/ansible_hosts
might be clearer with
echo "127.0.0.1" > ~/ansible_hosts
Thanks again,
yeah I’m going to fix that one tonight, ticket’s open. Thanks!
Yeah, I’ll file a ticket on https://github.com/ansible/ansible.github.com so we don’t forget.