jenkins集成ansible注意事项Failed to connect to the host via ssh.

  在集成jenkins和ansible实现自动化部署时,root用户下执行ansible命令时可以正常运行。由于是通过jenkins用户去执行ansible命令,而jenkins用户却报如下异常:

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

  

时间: 2024-10-29 10:33:29

jenkins集成ansible注意事项Failed to connect to the host via ssh.的相关文章

ansible Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak

中控机和远端主机配置完密钥后,在中控台上通过ansible检测联通性 ansible -i inventory.cfg all -m ping 10.1.1.1 | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak: No such file or dire

Jenkins连接git时出现“Failed to connect to repository : Command ... HEAD" returned status code 128:”的问题解决

网上说的解决方法如下: 其实生成ssh时不应该使用当前用户去生成ssh,而是使用jenkins这个用户去生成ssh,然后再去git服务器上配置你生成key,最后再jenkins上配置返回给你的key. 参考: http://www.jianshu.com/p/ed0edb93e234 http://stackoverflow.com/questions/21557998/jenkins-failed-to-connect-to-repository

Jenkins+Gitlab+Ansible自动化部署(六)

Pipeline Job实现Nginix+MySQL+PHP+Wordpress实现自动化部署交付(Jenkins+Gitlab+Ansible自动化部署(五)https://www.cnblogs.com/zd520pyx1314/p/10249094.html) 环境准备 编写ansible playbook脚本实现Wordpress远程部署 将wordpress源码与playbook部署脚本提交到gitlab仓库 编写pipeline job脚本实现Jenkins流水线持续交付流程 Jen

【jenkins git】Failed to connect to repository:Error performing command:git.exe ls-remote-h

jenkins使用git源码管理报错:Failed to connect to repository:Error performing command:git.exe ls-remote-h 本机需要安装git,设置好路径之后,重启jenkins 如下图: 解决:在 系统管理-Global Tool Configuration 设置本地git.exe的路径.如下图:

jenkins结合ansible用shell实现自动化部署和回滚

最近用jenkins+gitlab+ansible做持续化集成,自动化部署和版本回滚.然而deploy plugin没能做到增量升级和回滚操作,折腾了很久决定自己写个脚本来简单实现. 环境: centos 7.0 64位 gitlab:v2.9.0 git:2.9 jenkins 1.651.3.git plugin.GitLab Plugin.Dynamic Parameter Plug-in等 ansible:2.1.0.0 各工具职能: 1.gitlab做版本管理 2.jenkins根据指

jenkins gitlab整合注意事项

jenkins整合gitlab时,Source Code Management添加gitlab仓库路径无论怎么尝试都报如下两个异常: Failed to connect to repository : Command "git ls-remote -h [email protected]:xxx/dev_test.git HEAD" returned status code 128: stdout: stderr: Permission denied, please tryagain.

Failed to connect to VMware Lookup Service……SSL certificate verification failed.

今天登陆vspher web-client时候,报错如下: Failed to connect to VMware Lookup Service https://vc-test.cebbank.com:7444/lookupservice/sdk - SSL certificate verification failed. 放狗搜了下和自己测了下,根据问题类型有如下两种解决方案,我先说下如何去获取错误的详细信息,然后再给大家分别上两个解决办法. 1.获取错误日志 VSphere服务器进入%TEM

jenkins 集成部署站点

Jenkins 集成部署站点 最近为了在两台Linux中,去作jenkins的集成发布,所以在部署jenkins的这台电脑(A) 要把打包好的war 部署到远程服务器(B) 在两台电脑间进行传输的时候,要配置一个免登入的配置 1.1. 在A电脑上 ssh-keygen生成秘钥,同时把生成的id_ras.pub文件上传到B服务器(/home/${user}/.ssh/authorized_keys文件里) 1.2. 修改B服务器的 .ssh 文件属性为 700,authorized_keys为 6

解决Failed to connect session for conifg 故障

服务器升级openssh之后jenkins构建报错了,报错信息如下: Failed to connet or change directory jenkins.plugins.publish_over.BapPublisherException:Failed to connect session for config.....Message [Algorithm negotiation fail] 升级前ssh版本:OpenSSH_5.3p1 升级后sshl版本:OpenSSH_6.8pl 解决