community.general.jenkins_build module – Manage jenkins builds
Note
This module is part of the community.general collection (version 8.6.4).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.jenkins_build
.
New in community.general 2.2.0
Synopsis
Manage Jenkins builds with Jenkins REST API.
Aliases: web_infrastructure.jenkins_build
Requirements
The below requirements are needed on the host that executes this module.
python-jenkins >= 0.4.12
Parameters
Parameter |
Comments |
---|---|
A list of parameters to pass to the build. |
|
An integer which specifies a build of a job. Is required to remove a build from the queue. |
|
Enable detached mode to not wait for the build end. Choices:
|
|
Name of the Jenkins job to build. |
|
Password to authenticate with the Jenkins server. |
|
Attribute that specifies if the build is to be created, deleted or stopped. The Choices:
|
|
Time in seconds to wait between requests to the Jenkins server. This times must be higher than the configured quiet time for the job. Default: |
|
API token used to authenticate with the Jenkins server. |
|
URL of the Jenkins server. Default: |
|
User to authenticate with the Jenkins server. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: none |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- 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
- name: Stop a running jenkins build anonymously
community.general.jenkins_build:
name: "stop-check"
build_number: 3
state: stopped
url: http://localhost:8080
- 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
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Build info of the jenkins job. Returned: success |
|
Name of the jenkins job. Returned: success Sample: |
|
State of the jenkins job. Returned: success Sample: |
|
Url to connect to the Jenkins server. Returned: success Sample: |
|
User used for authentication. Returned: success Sample: |