community.general.jenkins_build – Manage jenkins builds

Note

This plugin is part of the community.general collection (version 2.5.1).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.jenkins_build.

New in version 2.2.0: of community.general

Synopsis

  • Manage Jenkins builds with Jenkins REST API.

Requirements

The below requirements are needed on the host that executes this module.

  • python-jenkins >= 0.4.12

Parameters

Parameter Choices/Defaults Comments
args
dictionary
A list of parameters to pass to the build.
build_number
integer
An integer which specifies a build of a job. Is required to remove a build from the queue.
name
string / required
Name of the Jenkins job to build.
password
string
Password to authenticate with the Jenkins server.
state
string
    Choices:
  • present ←
  • absent
Attribute that specifies if the build is to be created or deleted.
token
string
API token used to authenticate with the Jenkins server.
url
string
Default:
"http://localhost:8080"
URL of the Jenkins server.
user
string
User to authenticate with the Jenkins server.

Examples

- name: Create a jenkins build using basic authentication
  community.general.jenkins_build:
    name: "test-check"
    args:
      cloud: "test"
      availability_zone: "test_az"
    user: admin
    password: asdfg
    url: http://localhost:8080

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
build_info
dictionary
success
Build info of the jenkins job.

name
string
success
Name of the jenkins job.

Sample:
test-job
state
string
success
State of the jenkins job.

Sample:
present
url
string
success
Url to connect to the Jenkins server.

Sample:
https://jenkins.mydomain.com
user
string
success
User used for authentication.

Sample:
admin


Authors

  • Brett Milford (@brettmilford)