实际存在时缺少所需的点子包装吗?

时间:2018-10-22 20:00:49

标签: pip ansible

我正在运行下面的ansible剧本,并收到以下消息

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 &apos;You get a pipeline, she gets a pipeline... you all get pipelines...&apos; }
    </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? idk

1 个答案:

答案 0 :(得分:0)

不知道真正的问题是什么,但是安装yum而不是pip起作用了?