为什么它不允许我从Ansible安装Tomcat?

时间:2015-07-15 14:23:50

标签: ssh permissions install ansible

我正在学习使用Ansible来安装Tomcat,我已经安装了Ansible,创建并复制了ssh密钥,写了一本剧本,但是当我试图运行该剧本时,它给了我以下错误:

    <192.168.29.13> ESTABLISH CONNECTION FOR USER: root
    <192.168.29.13> REMOTE_MODULE setup
    <192.168.29.13> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/fni/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.29.13 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1436969031.23-114682339176496 && echo $HOME/.ansible/tmp/ansible-tmp-1436969031.23-114682339176496'

fatal: [192.168.29.13] => SSH Error: Permission denied (publickey,password,keyboard-interactive).
    while connecting to 192.168.29.13:22

我无法理解所有这一切,但似乎在最后一步,它试图创建一个新目录:$ HOME / .ansible / tmp / ansible-tmp-1436969031.23-114682339176496

所以我检查了tmp目录的权限,并将其设置为:rwxrwxrwx

我觉得这次它不应该有权限问题,所以我再次运行了palybook,但是下面遇到了类似的错误:

    <192.168.29.13> ESTABLISH CONNECTION FOR USER: root
    <192.168.29.13> REMOTE_MODULE setup
    <192.168.29.13> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/fni/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.29.13 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1436969284.93-135829741473588 && echo $HOME/.ansible/tmp/ansible-tmp-1436969284.93-135829741473588'

fatal: [192.168.29.13] => SSH Error: Permission denied (publickey,password,keyboard-interactive).
    while connecting to 192.168.29.13:22

对于ssh密钥,我已按照本文中的步骤进行操作,因此不应再要求输入密码:Why do I still have to enter password after I entered ssh-agent and ssh-add?

我想知道是否还有其他人遇到过同样的问题以及如何修复它?

1 个答案:

答案 0 :(得分:0)

经过2天的奋斗,我终于找到了原因,似乎我的ping请求通过,但是playbook命令不能,所以我做了“-vvvv”并将结果并排比较,发现用户ID应该在它前面有一些东西:myproject \ my_id,然后就可以了。