community.general.jenkins_node module – Manage Jenkins nodes
Note
This module is part of the community.general collection (version 10.1.0).
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_node
.
New in community.general 10.0.0
Synopsis
Manage Jenkins nodes with Jenkins REST API.
Requirements
The below requirements are needed on the host that executes this module.
python-jenkins >= 0.4.12
Parameters
Parameter |
Comments |
---|---|
When specified, sets the Jenkins node labels. |
|
Name of the Jenkins node to manage. |
|
When specified, sets the Jenkins node executor count. |
|
Specifies the offline reason message to be set when configuring the Jenkins node state. If Internally |
|
Specifies whether the Jenkins node should be Choices:
|
|
API token to authenticate with the Jenkins server. |
|
URL of the Jenkins server. Default: |
|
User to authenticate with the Jenkins server. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: partial Check mode is unable to show configuration changes for a node that is not yet present. |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- name: Create a Jenkins node using token authentication
community.general.jenkins_node:
url: http://localhost:8080
user: jenkins
token: 11eb751baabb66c4d1cb8dc4e0fb142cde
name: my-node
state: present
- name: Set number of executors on Jenkins node
community.general.jenkins_node:
name: my-node
state: present
num_executors: 4
- name: Set labels on Jenkins node
community.general.jenkins_node:
name: my-node
state: present
labels:
- label-1
- label-2
- label-3
- name: Set Jenkins node offline with offline message.
community.general.jenkins_node:
name: my-node
state: disabled
offline_message: >
This node is offline for some reason.
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Whether or not the Jenkins node was configured by the task. Returned: success |
|
Whether or not the Jenkins node was created by the task. Returned: success |
|
Whether or not the Jenkins node was deleted by the task. Returned: success |
|
Whether or not the Jenkins node was disabled by the task. Returned: success |
|
Whether or not the Jenkins node was enabled by the task. Returned: success |
|
Name of the Jenkins node. Returned: success Sample: |
|
State of the Jenkins node. Returned: success Sample: |
|
URL used to connect to the Jenkins server. Returned: success Sample: |
|
User used for authentication. Returned: success Sample: |