community.general.jenkins_build (8.5.0) — module

Manage jenkins builds

| "added in version" 2.2.0 of community.general"

Authors: Brett Milford (@brettmilford), Tong He (@unnecessary-username), Juan Casanova (@juanmcasanova)

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manage Jenkins builds with Jenkins REST API.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a jenkins build using basic authentication
  community.general.jenkins_build:
    name: "test-check"
    args:
      cloud: "test"
      availability_zone: "test_az"
    state: present
    user: admin
    password: asdfg
    url: http://localhost:8080
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stop a running jenkins build anonymously
  community.general.jenkins_build:
    name: "stop-check"
    build_number: 3
    state: stopped
    url: http://localhost:8080
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete a jenkins build using token authentication
  community.general.jenkins_build:
    name: "delete-experiment"
    build_number: 30
    state: absent
    user: Jenkins
    token: abcdefghijklmnopqrstuvwxyz123456
    url: http://localhost:8080

Inputs

    
url:
    default: http://localhost:8080
    description:
    - URL of the Jenkins server.
    type: str

args:
    description:
    - A list of parameters to pass to the build.
    type: dict

name:
    description:
    - Name of the Jenkins job to build.
    required: true
    type: str

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

state:
    choices:
    - present
    - absent
    - stopped
    default: present
    description:
    - Attribute that specifies if the build is to be created, deleted or stopped.
    - The V(stopped) state has been added in community.general 3.3.0.
    type: str

token:
    description:
    - API token used to authenticate with the Jenkins server.
    type: str

detach:
    default: false
    description:
    - Enable detached mode to not wait for the build end.
    type: bool
    version_added: 7.4.0
    version_added_collection: community.general

password:
    description:
    - Password to authenticate with the Jenkins server.
    type: str

build_number:
    description:
    - An integer which specifies a build of a job. Is required to remove a build from
      the queue.
    type: int

time_between_checks:
    default: 10
    description:
    - Time in seconds to wait between requests to the Jenkins server.
    - This times must be higher than the configured quiet time for the job.
    type: int
    version_added: 7.4.0
    version_added_collection: community.general

Outputs

build_info:
  description: Build info of the jenkins job.
  returned: success
  type: dict
name:
  description: Name of the jenkins job.
  returned: success
  sample: test-job
  type: str
state:
  description: State of the jenkins job.
  returned: success
  sample: present
  type: str
url:
  description: Url to connect to the Jenkins server.
  returned: success
  sample: https://jenkins.mydomain.com
  type: str
user:
  description: User used for authentication.
  returned: success
  sample: admin
  type: str