首页 > 解决方案 > 从 Jenkins 调用 Ansible 时出现问题

问题描述

当我通过 Jenkins 调用 Ansible 时,我在我的剧本中添加了以下脚本

- name: HELLO WORLD PLAY
  hosts: webserver
  become: yes
  become_method: sudo
  tasks:
  - debug:
    msg: "HELLO......."
  - shell: echo "HELLO WORLD"

当我建立工作时,我遇到了错误

TASK [setup] *******************************************************************
fatal: [10.142.0.13]: UNREACHABLE! => 
{
  "changed": false, 
  "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue", 
  "unreachable": true
}

当我通过 CLI 运行此剧本时,它运行成功,但我无法通过 Jenkins 运行(我已经通过在 Jenkins 中粘贴私钥完成了设置)

标签: jenkins-pipeline

解决方案


推荐阅读