�
�Udac @` s d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l Z d Z y d d l Z e Z Wn# e k
r� e j � Z e Z n Xd d l m Z m Z d d
l m Z d � Z d � Z d � Z d � Z e d k re � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: jenkins_job_info
short_description: Get information about Jenkins jobs
version_added: "2.5"
description:
- This module can be used to query information about which Jenkins jobs which already exists.
- This module was called C(jenkins_job_info) before Ansible 2.9. The usage did not change.
requirements:
- "python-jenkins >= 0.4.12"
options:
name:
description:
- Exact name of the Jenkins job to fetch information about.
glob:
description:
- A shell glob of Jenkins job names to fetch information about.
color:
description:
- Only fetch jobs with the given status color.
password:
description:
- Password to authenticate with the Jenkins server.
- This is a required parameter, if C(token) is not provided.
token:
description:
- API token used to authenticate with the Jenkins server.
- This is a required parameter, if C(password) is not provided.
url:
description:
- URL where the Jenkins server is accessible.
default: http://localhost:8080
user:
description:
- User to authenticate with the Jenkins server.
validate_certs:
description:
- If set to C(False), the SSL certificates will not be validated.
- This should only set to C(False) used on personally controlled sites using self-signed certificates.
default: true
type: bool
version_added: "2.6"
author:
- "Chris St. Pierre (@stpierre)"
st
# Get all Jenkins jobs using basic auth
- jenkins_job_info:
user: admin
password: hunter2
register: my_jenkins_job_info
# Get all Jenkins jobs using the token
- jenkins_job_info:
user: admin
token: abcdefghijklmnop
register: my_jenkins_job_info
# Get info about a single job using basic auth
- jenkins_job_info:
name: some-job-name
user: admin
password: hunter2
register: my_jenkins_job_info
# Get info about a single job in a folder using basic auth
- jenkins_job_info:
name: some-folder-name/some-job-name
user: admin
password: hunter2
register: my_jenkins_job_info
# Get info about jobs matching a shell glob using basic auth
- jenkins_job_info:
glob: some-job-*
user: admin
password: hunter2
register: my_jenkins_job_info
# Get info about all failing jobs using basic auth
- jenkins_job_info:
color: red
user: admin
password: hunter2
register: my_jenkins_job_info
# Get info about passing jobs matching a shell glob using basic auth
- jenkins_job_info:
name: some-job-*
color: blue
user: admin
password: hunter2
register: my_jenkins_job_info
- name: Get the info from custom URL with token and validate_certs=False
jenkins_job_info:
user: admin
token: 126df5c60d66c66e3b75b11104a16a8a
url: https://jenkins.example.com
validate_certs: False
register: my_jenkins_job_info
s;
---
jobs:
description: All jobs found matching the specified criteria
returned: success
type: list
sample:
[
{
"name": "test-job",
"fullname": "test-folder/test-job",
"url": "http://localhost:8080/job/test-job/",
"color": "blue"
},
]
N( t
AnsibleModulet missing_required_lib( t to_nativec C` s� | j d } | j j d � } | j j d � } | j j d � } | j j d � } | rz t t d � rz t j t _ n | r� t t d � r� | j d d � n | r� | s� | r� t j | | | p� | � S| r� t j | | � St j | � Sd S( Nt urlt usert passwordt tokent validate_certst
SSLContextt msgsy Module does not support changing verification mode with python < 2.7.9. Either update Python or use validate_certs=false.( t paramst gett hasattrt sslt _create_unverified_contextt _create_default_https_contextt fail_jsont jenkinst Jenkins( t moduleR t usernameR
R R ( ( sW /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/jenkins_job_info.pyt get_jenkins_connection� s
c C` s/ t s+ | j d t d d d �d t � n d S( NR s python-jenkinsR s<