jenkins_job_facts – Get facts about Jenkins jobs
jenkins_job_facts – Get facts about Jenkins jobs
New in version 2.5.
Synopsis
- This module can be used to query the facts about which Jenkins jobs which already exists.
Requirements
The below requirements are needed on the host that executes this module.
- python-jenkins >= 0.4.12
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
color - |
Only fetch jobs with the given status color. | |
glob - |
A shell glob of Jenkins job names to fetch facts about. | |
name - |
Exact name of the Jenkins job to fetch facts about. | |
password - |
Password to authenticate with the Jenkins server. This is a required parameter, if | |
token - |
API token used to authenticate with the Jenkins server. This is a required parameter, if | |
url - |
Default: |
URL where the Jenkins server is accessible. |
user - |
User to authenticate with the Jenkins server. | |
validate_certs boolean added in 2.6 |
|
If set to This should only set to |
Examples
# Get all Jenkins jobs using basic auth
- jenkins_job_facts:
user: admin
password: hunter2
register: my_jenkins_job_facts
# Get all Jenkins jobs using the token
- jenkins_job_facts:
user: admin
token: abcdefghijklmnop
register: my_jenkins_job_facts
# Get facts about a single job using basic auth
- jenkins_job_facts:
name: some-job-name
user: admin
password: hunter2
register: my_jenkins_job_facts
# Get facts about a single job in a folder using basic auth
- jenkins_job_facts:
name: some-folder-name/some-job-name
user: admin
password: hunter2
register: my_jenkins_job_facts
# Get facts about jobs matching a shell glob using basic auth
- jenkins_job_facts:
glob: some-job-*
user: admin
password: hunter2
register: my_jenkins_job_facts
# Get facts about all failing jobs using basic auth
- jenkins_job_facts:
color: red
user: admin
password: hunter2
register: my_jenkins_job_facts
# Get facts about passing jobs matching a shell glob using basic auth
- jenkins_job_facts:
name: some-job-*
color: blue
user: admin
password: hunter2
register: my_jenkins_job_facts
- name: Get the facts from custom URL with token and validate_certs=False
jenkins_job_facts:
user: admin
token: 126df5c60d66c66e3b75b11104a16a8a
url: https://jenkins.example.com
validate_certs: False
register: my_jenkins_job_facts
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
jobs list |
success |
All jobs found matching the specified criteria
Sample: [{'name': 'test-job', 'fullname': 'test-folder/test-job', 'url': 'http://localhost:8080/job/test-job/', 'color': 'blue'}] |
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors
- Chris St. Pierre (@stpierre)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.8/modules/jenkins_job_facts_module.html