ansible.builtin.jenkins_job_facts (v2.5.6) — module

Get facts about Jenkins jobs

| "added in version" 2.5 of ansible.builtin"

Authors: Chris St. Pierre (@stpierre)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.6

Description

Query facts about which Jenkins jobs exist


Requirements

Usage examples

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

Inputs

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

glob:
    description:
    - A shell glob of Jenkins job names to fetch facts about.
    required: false

name:
    description:
    - Exact name of the Jenkins job to fetch facts about.
    required: false

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

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

token:
    description:
    - API token used to authenticate alternatively to C(password).
    required: false

password:
    description:
    - Password to authenticate with the Jenkins server.
    required: false

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