【发布时间】:2018-10-24 04:47:45
【问题描述】:
我正在运行下面的 ansible playbook,并收到以下消息
TASK [Set up pipeline] ***********************************************************************************************************************************************************************************************************************
fatal: [35.153.53.5]: FAILED! => {"changed": false, "msg": "python-jenkins required for this module. see http://python-jenkins.readthedocs.io/en/latest/install.html"}
to retry, use: --limit @~/Repositories/terraform-jenkins/ansible/jenkins.retry
有趣的是……它确实存在
[ec2-user@ip-172-31-43-13 ~]$ pip list |grep jenkins
jenkins-python 1.1
python-jenkins 1.3.0
[ec2-user@ip-172-31-43-13 ~]$ sudo !!
sudo pip list |grep jenkins
jenkins-python 1.1
python-jenkins 1.3.0
Ansible 版本
ansible 2.6.4
config file = None
configured module search path = [u'/Users/jddaniel/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.15 (default, Jul 23 2018, 21:27:06) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)]
详细日志
https://gist.github.com/ehime/ee08545fcb8e13d16ca801d1771d7461
这是我的剧本
#
# Ansible to provision Jenkins on remote host
#
- name: Install Jenkins and its plugins
hosts: all
become: yes
become_method: sudo
gather_facts: yes
pre_tasks:
- name: CA-Certificates update command line execution
command: /bin/update-ca-trust
vars:
jenkins_hostname: localhost
jenkins_http_port: 8080
roles:
- geerlingguy.repo-epel # required for pip
- geerlingguy.java
- geerlingguy.jenkins
tasks:
# TODO fix upstream
- name: Make Groovy folder writable
file:
path: /var/lib/jenkins/init.groovy.d
state: directory
# TODO verify this is what it should be
mode: 0777
- name: Install dependencies
yum:
name:
- git
- python2-pip
- name: Force upgrade pip
pip:
name: pip
extra_args: --upgrade
- name: Install dependencies for Jenkins modules
pip:
name: python-jenkins
- name: Install build pipeline
jenkins_plugin:
name:
- build-pipeline-plugin
- workflow-aggregator
url_username: "{{ jenkins_admin_username }}"
url_password: "{{ jenkins_admin_password }}"
- name: Set up pipeline
jenkins_job:
config: "{{ lookup('file', '_files/jobs.xml') }}"
name: test-auto
user: "{{ jenkins_admin_username }}"
password: "{{ jenkins_admin_password }}"
....这里可能发生了什么? ...
这里是jobs.xml,如果你想在你的寂寞中尝试它
<?xml version='1.0' encoding='UTF-8'?>
<flow-definition plugin="workflow-job@2.10">
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<triggers/>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
</properties>
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.30">
<script>
node { echo 'You get a pipeline, she gets a pipeline... you all get pipelines...' }
</script>
<sandbox>true</sandbox>
</definition>
<triggers/>
</flow-definition>
操作系统信息
[ec2-user@ip-172-31-43-13 ~]$ hostnamectl
Static hostname: ip-172-31-43-13.ec2.internal
Icon name: computer
Chassis: n/a
Machine ID: 8df22ad8f77c4d84bc36f0456b1fd0d7
Boot ID: 4981022b5a1c4d0d8bd659ca4ceeb071
Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
Kernel: Linux 3.10.0-123.8.1.el7.x86_64
Architecture: x86_64
操作系统信息可能是草图,因为lsb_release 不可用...我在 AWS 上使用ami-a8d369c0,它说它是 RHEL 7.0...可能是剥离的 AMI?身份证
【问题讨论】:
-
您能否发布
ansible --version的输出,并检查以更高详细度运行该作业的输出,看看pip:步骤做了什么? -
@MatthewLDaniel gist.github.com/ehime/ee08545fcb8e13d16ca801d1771d7461 和 ansible 2.6.4 配置文件 = 未配置模块搜索路径 = [u'/Users/jddaniel/.ansible/plugins/modules', u'/usr/share/ ansible/plugins/modules'] ansible python 模块位置 = /usr/local/lib/python2.7/site-packages/ansible 可执行位置 = /usr/local/bin/ansible python 版本 = 2.7.15(默认,7 月 23 日2018, 21:27:06) [GCC 4.2.1 兼容 Apple LLVM 9.1.0 (clang-902.0.39.2)]