Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2764704
  • 博文数量: 587
  • 博客积分: 6356
  • 博客等级: 准将
  • 技术积分: 6410
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-23 10:54
个人简介

器量大者,福泽必厚

文章分类

全部博文(587)

文章存档

2019年(3)

2018年(1)

2017年(29)

2016年(39)

2015年(66)

2014年(117)

2013年(136)

2012年(58)

2011年(34)

2010年(50)

2009年(38)

2008年(16)

分类: LINUX

2016-06-03 18:26:39

搭建好ansible后,在/etc/ansible/hosts 文件中添加如下:
[all]
192.168.220.141 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass=root

然后在机器上执行:
[root@localhost ansible]#  ansible all -m ping
192.168.220.141 | UNREACHABLE! => {
    "changed": false, 
    "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", 
    "unreachable": true
}
好奇怪啊, 以前搞的时候挺顺利的!
不得已只好
[root@localhost ansible]#  ansible all -m ping -vvvv 
......
......
......

问题原因:
Since you are not using SSH keys to authenticate, you must try running "export ANSIBLE_SCP_IF_SSH=y" before running ansible-playbook with -vvv option. 


最后找到解决方法:

[root@localhost ansible]#  export ANSIBLE_SCP_IF_SSH=y  ##执行这个命令即可正常!
[root@localhost ansible]#  ansible all -m ping
192.168.220.141 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}

 
阅读(7654) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~