jenkins集成ansible注意事项Failed to connect to the host via ssh.
2016-07-11 08:47
691 查看
在集成jenkins和ansible实现自动化部署时,root用户下执行ansible命令时可以正常运行。由于是通过jenkins用户去执行ansible命令,而jenkins用户却报如下异常:
找了好久也没找到相应的解决办法,后来在http://superuser.com/questions/1081609/ansible-how-to-set-a-default-ssh-user-for-all-hosts上找到了相应的解决办法。
设置以root用户执行ansible,将remote_user = root前的注释符去掉,再次运行即可。
再次执行,成功返回执行信息。
XXXXXXX | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true }
找了好久也没找到相应的解决办法,后来在http://superuser.com/questions/1081609/ansible-how-to-set-a-default-ssh-user-for-all-hosts上找到了相应的解决办法。
设置以root用户执行ansible,将remote_user = root前的注释符去掉,再次运行即可。
# default user to use for playbooks if user is not specified # (/usr/bin/ansible will use current user as default) remote_user = root
再次执行,成功返回执行信息。
-bash-4.2$ ansible webservers -m command -a "free -m" xxxx | SUCCESS | rc=0 >> total used free shared buffers cached Mem: 1518 292 1225 0 42 125 -/+ buffers/cache: 125 1393 Swap: 0 0 0
相关文章推荐
- POJ 1273 Drainage Ditches(最大流模板)
- AIDL介绍和实例讲解
- AIDL介绍和实例讲解
- 模糊图片秒转高清图
- Helvetic Coding Contest 2016 C2. Brain Network (medium)
- 关于int main( int argc, char* argv[] ) 中arg和argv参数的解析及调试
- 关于LogStash运行在AIX 64位机器上的问题与临时解决方案
- 《leetCode》:Contains Duplicate III
- LIBSVM学习(七)--参数解释
- 关于akka的mailbox的size问题
- Rails的事务和锁
- Hdu 5319 Painter (模拟)
- Codeforces Round #271 (Div. 2) F. Ant colony(线段树)
- 1106. Lowest Price in Supply Chain (25)
- Exchange 2010 PS 之Set-CASMailbox!
- Repair the Wall(贪心 区间覆盖)
- 在用hadoop fs -ls 时报failed onconnetion的错误
- LeetCode 373 Find K Pairs with Smallest Sums
- 出现ping:unknow host www.baidu.com的问题解决
- leetcode 217. Contains Duplicat hash解法及相关hashmap与hashset问题