ceph-3 | FAILED => 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
ceph-2 | FAILED => 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
命令执行失败,我们使用-vvvv选项查看详细信息:
ansible -vvvv osd -a 'uptime'
输出:
ebug1: Trying private key: /home/fgp/.ssh/id_rsadebug3: no such identity: /home/fgp/.ssh/id_rsa: No such file or directorydebug1: Trying private key: /home/fgp/.ssh/id_dsadebug3: no such identity: /home/fgp/.ssh/id_dsa: No such file or directorydebug1: Trying private key: /home/fgp/.ssh/id_ecdsadebug3: no such identity: /home/fgp/.ssh/id_ecdsa: No such file or directorydebug1: Trying private key: /home/fgp/.ssh/id_ed25519debug3: no such identity: /home/fgp/.ssh/id_ed25519: No such file or directorydebug2: we did not send a packet, disable methoddebug1: No more authentication methods to try.
Permission denied (publickey,password).
~ ssh-keygen [1/1877]
Generating public/private rsa key pair.
Enter file in which to save the key (/home/fgp/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/fgp/.ssh/id_rsa.
Your public key has been saved in /home/fgp/.ssh/id_rsa.pub.
The key fingerprint is:49:8b:d0:a0:29:69:c8:32:50:3d:fc:8a:0a:4e:c8:1d fgp@ceph-0The key's randomart image is:+--[ RSA 2048]----+
|...o. |
|+. o+o |
|*oo .o. . |
|oo E ..o o |
|o ..... S |
|oo... |
|+. |
|.. |
| |
+-----------------+
ceph-1 | FAILED | rc=100 >>E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)E: Unable to lock directory /var/lib/apt/lists/E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
ceph-2 | FAILED | rc=100 >>E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)E: Unable to lock directory /var/lib/apt/lists/E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
ceph-3 | FAILED | rc=100 >>E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)E: Unable to lock directory /var/lib/apt/lists/E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
执行失败了,显然是由于没有root权限,需要使用sudo执行命令,需要`--sudo``选项:
ansible all --sudo -m shell -a 'apt-get update -y'