Skip to content
SRE运维进阶之路SRE运维进阶之路
github icon
  • Jenkins

    • Jenkins 学习笔记
      • 1 Jenkins 简介

        • 1.1 DevOps、CI、CD都是什么鬼?
          • 1.2 Jenkins简介
          • 2 安装 Jenkins

            • 2.1 yum 安装 jenkins
              • 2.2 war 包安装 jenkins
                • 2.3 使用 ansible 安装 jenkins
                  • 2.4 使用docker安装jenkins
                  • 3 使用 Jenkins

                    • 3.1 Jenkins用户权限管理
                      • 3.2 访问 API
                      • 4 流水线核心语法

                        • 4.1 开始编写Jenkinsfile
                          • 4.2 Jenkins流水线语法
                            • 4.3 Groovy 简明教程
                              • 4.4 Jenkins共享库应用
                                • 4.5 共享库之钉钉消息推送
                                  • 4.6 流水线开发工具
                                    • 4.7 pipeline 生产配置实例
                                      • 4.8 在 VS Code 中校验 Jenkinsfile
                                      • 5 流水线集成篇

                                        • 5.1 构建发布工具集成
                                          • 5.2 用户认证系统集成
                                          • 6 管理 jenkins

                                            • 6.1 Jenkins 关闭和重启的实现方式
                                            • 7 日常维护

                                              • 7.1 Jenkins Job迁移
                                              • 8 Jenkins 常见问题
                                              • Ansible

                                                • Ansible 学习笔记
                                                  • 1 初识Ansible
                                                    • 2 Ansible Inventory配置详解
                                                      • 3 Ansible Ad-hoc命令集

                                                        • 3.1 Ansible Ad-hoc 常用命令集
                                                          • 3.2 Ansible lineinfile模块详解
                                                          • 4 Ansible Playbook

                                                            • 4.1 Playbook的结构及handler用法
                                                              • 4.2 Playbook循环语句
                                                                • 4.3 Playbook条件语句
                                                                  • 4.4 Playbook高级用法
                                                                    • 4.5 Playbook之tags
                                                                      • 4.6 巧用Roles
                                                                        • 4.7 Jinja2 模板
                                                                          • 4.8 yaml语法
                                                                          • 5 Ansible变量

                                                                            • 5.1 自定义变量
                                                                              • 5.2 Fact变量
                                                                                • 5.3 魔法变量
                                                                                  • 5.4 使用lookup生成变量
                                                                                    • 5.5 使用vault配置加密
                                                                                    • 6 Ansible使用优化
                                                                                      • 7 常见问题
                                                                                        • 4.3 关于ssh连接一些常见的错误说明
                                                                                        • 8 综合项目

                                                                                          • 使用 ansible 快速安装 k8s 机器

                                                                                        7 常见问题

                                                                                        author iconClaycalendar icon2020年3月20日category icon
                                                                                        • 自动化工具
                                                                                        tag icon
                                                                                        • Ansible
                                                                                        timer icon大约 1 分钟

                                                                                        此页内容
                                                                                        • 4.3 关于ssh连接一些常见的错误说明

                                                                                        # 7 常见问题

                                                                                        # 4.3 关于ssh连接一些常见的错误说明

                                                                                        1. ERROR! to use the 'ssh' connection type with passwords, you must install the sshpass program

                                                                                        完整错误示例如下:

                                                                                        root@ctnr:/etc/ansible# ansible '*.a32-168-1.*' -m ping
                                                                                        ctnr.a32-168-1.prod.yiz | FAILED! => {
                                                                                            "failed": true, 
                                                                                            "msg": "ERROR! to use the 'ssh' connection type with passwords, you must install the sshpass program"
                                                                                        }
                                                                                        
                                                                                        1
                                                                                        2
                                                                                        3
                                                                                        4
                                                                                        5

                                                                                        一般出现这种错误,是在通过密码验证远程被管理机的时候,需要在server端安装sshpass:

                                                                                        yum install sshpass -y 
                                                                                        
                                                                                        1
                                                                                        1. Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host

                                                                                        完整错误如下:

                                                                                        ansible test -a 'uptime'
                                                                                        
                                                                                        192.168.1.1| FAILED =>Using a SSH password instead of a key is not possible because HostKey checking is enabled and sshpass does not support this.Please add this host's fingerprint to your known_hosts file to manage this host.
                                                                                        192.168.1.2 | FAILED => Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host.
                                                                                        
                                                                                        1
                                                                                        2
                                                                                        3
                                                                                        4

                                                                                        这种错误通常就出现在server端第一次连接被管理机的时候,就是上面说到的需要通过输入yes/no进行确认将key字符串加入到~/.ssh/known_hosts文件中。

                                                                                        解决办法有两个:

                                                                                        • 通过修改上面提到的host_key_checking,将其设置为false
                                                                                        • 通过修改ssh_args参数,修改如下:
                                                                                        ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no 
                                                                                        
                                                                                        1
                                                                                        edit icon编辑此页open in new window
                                                                                        上次编辑于: 2022/4/27 15:33:00
                                                                                        贡献者: clay-wangzhi
                                                                                        上一页
                                                                                        6 Ansible使用优化
                                                                                        备案号:冀ICP备2021007336号
                                                                                        Copyright © 2023 Clay