Ansible 连接问题 - /etc/hosts

Ansible 连接问题 - /etc/hosts

安塞布尔2.9.6,蟒蛇2.7.5

/etc/hosts -> server1 = 10.2.242.4

当我ansible server1 -m command -a "pwd" -vvv正常工作时,当我尝试运行剧本时,ansible-playbook -i inventory test.yml -vvv我仍然得到:

<10.2.242.4> ESTABLISH SSH CONNECTION FOR USER: root
<10.2.242.4> SSH: EXEC ssh -C -o ControlMaster=no -o ControlPersist=60s -o Port=22 -o 'IdentityFile="/root/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/f076bfb64e 10.2.242.4 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<10.2.242.4> (0, '/root\n', '')

库存文件:

[waw2]
server1 ansible_host=10.2.242.4

[waw2:vars]
ansible_ssh_port=22
ansible_user=root

我的 root 公钥已添加到目标服务器。在ansible.cfg[ssh_connection] 部分中没有任何改变

我缺少什么?

答案1

gather_subset=!hardware已解决,在 ansible.cfg 中设置有帮助

相关内容