Host ist für Ansible UNREACHABLE

Krull

Well-Known Member
Hallo,
ich habe meinen RaspberryPi kürzlich leider ein wenig kaputt gespielt, weshalb ich ein frisches Abbild von Raspbian auf die SD-Karte kopiert habe. Manuell kann ich mich auch mit "ssh pi@192.168.1.4" auf dem Rechner anmelden. Mit einer Ansible-Rolle würde ich nun gerne den alten Systemzustand weiderherstellen. Leider scheitert das, weil Ansible scheinbar nicht mal auf den Rechner kommt:
Code:
$ ansible raspberry -m ping -vvv --ask-pass       
ansible [core 2.11.6]   
  config file = /usr/local/etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/local/share/py38-ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/local/share/py38-ansible/collections
  executable location = /usr/local/bin/ansible      
  python version = 3.8.12 (default, Sep 21 2021, 01:09:51) [Clang 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611a
  jinja version = 3.0.1
  libyaml = True
Using /usr/local/etc/ansible/ansible.cfg as config file
SSH password:
host_list declined parsing /usr/local/etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /usr/local/etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /usr/local/etc/ansible/hosts as it did not pass its verify_file() method
Parsed /usr/local/etc/ansible/hosts inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
META: ran handlers
<192.168.1.4> ESTABLISH SSH CONNECTION FOR USER: pi
<192.168.1.4> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey -o StrictHostKeyChecking=no -o 'User="pi"' -o
 ConnectTimeout=30 -o PreferredAuthentications=password -o ControlPath=/usr/home/user/.ansible/cp/0cec436af9 192.168.1.4 '/bin/sh -c '"'"'echo ~pi && sleep 0'"'"''
<192.168.1.4> (255, b'', b'pi@192.168.1.4: Permission denied (publickey,password).\r\n')
raspberry | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: pi@192.168.1.4: Permission denied (publickey,password).",
    "unreachable": true
}
Wieso klappt das nicht? Benutzer und Passwort sind auf jeden Fall richtig.
 
Die Nachricht von ssh ist ja Permission denied (publickey,password), also hats wohl da etwas. Ich würds erstmal mit Pubkey Auth probieren, ich denke beim Passwort ist ein Fehler passiert, entweder dir, oder vielleicht auch beim parsen, oder die Shell escaped irgend was komisch.
 
Die Nachricht von ssh ist ja Permission denied (publickey,password), also hats wohl da etwas. Ich würds erstmal mit Pubkey Auth probieren, ich denke beim Passwort ist ein Fehler passiert, entweder dir, oder vielleicht auch beim parsen, oder die Shell escaped irgend was komisch.
Mit Pubkey Auth geht es. Ich Frage ist nur, wieso es mit Passwort nicht klappt. Eingegeben habe ich es sicher richtig. Wie gesagt, manuelles Anmelden mit Passwort über ssh funktioniert ja.
 
Zurück
Oben