community.general.jenkins_job_facts (0.1.4) — module

Get information about Jenkins jobs

Authors: Chris St. Pierre (@stpierre)

Install collection

Install with ansible-galaxy collection install community.general:==0.1.4


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.4

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Get all Jenkins jobs using basic auth
- jenkins_job_info:
    user: admin
    password: hunter2
  register: my_jenkins_job_info
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Get all Jenkins jobs using the token
- jenkins_job_info:
    user: admin
    token: abcdefghijklmnop
  register: my_jenkins_job_info
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Get info about all failing jobs using basic auth
- jenkins_job_info:
    color: red
    user: admin
    password: hunter2
  register: my_jenkins_job_info
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
url:
    default: http://localhost:8080
    description:
    - URL where the Jenkins server is accessible.

glob:
    description:
    - A shell glob of Jenkins job names to fetch information about.

name:
    description:
    - Exact name of the Jenkins job to fetch information about.

user:
    description:
    - User to authenticate with the Jenkins server.

color:
    description:
    - Only fetch jobs with the given status color.

token:
    description:
    - API token used to authenticate with the Jenkins server.
    - This is a required parameter, if C(password) is not provided.

password:
    description:
    - Password to authenticate with the Jenkins server.
    - This is a required parameter, if C(token) is not provided.

validate_certs:
    default: true
    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.
    type: bool

Outputs

jobs:
  description: All jobs found matching the specified criteria
  returned: success
  sample:
  - color: blue
    fullname: test-folder/test-job
    name: test-job
    url: http://localhost:8080/job/test-job/
  type: list