ansible / ansible.builtin / v2.6.0 / module / jenkins_job Manage jenkins jobs | "added in version" 2.2 of ansible.builtin" Authors: Sergio Millan Rodriguez (@sermilrod) preview | supported by communityansible.builtin.jenkins_job (v2.6.0) — module
pip
Install with pip install ansible==2.6.0
Manage Jenkins jobs by using Jenkins REST API.
# Create a jenkins job using basic authentication - jenkins_job: config: "{{ lookup('file', 'templates/test.xml') }}" name: test password: admin url: http://localhost:8080 user: admin
# Create a jenkins job using the token - jenkins_job: config: "{{ lookup('template', 'templates/test.xml.j2') }}" name: test token: asdfasfasfasdfasdfadfasfasdfasdfc url: http://localhost:8080 user: admin
# Delete a jenkins job using basic authentication - jenkins_job: name: test password: admin state: absent url: http://localhost:8080 user: admin
# Delete a jenkins job using the token - jenkins_job: name: test token: asdfasfasfasdfasdfadfasfasdfasdfc state: absent url: http://localhost:8080 user: admin
# Disable a jenkins job using basic authentication - jenkins_job: name: test password: admin enabled: False url: http://localhost:8080 user: admin
# Disable a jenkins job using the token - jenkins_job: name: test token: asdfasfasfasdfasdfadfasfasdfasdfc enabled: False url: http://localhost:8080 user: admin
url: default: http://localhost:8080 description: - Url where the Jenkins server is accessible. required: false name: description: - Name of the Jenkins job. required: true user: description: - User to authenticate with the Jenkins server. required: false state: choices: - present - absent default: present description: - Attribute that specifies if the job has to be created or deleted. required: false token: description: - API token used to authenticate alternatively to password. required: false config: description: - config in XML format. - Required if job does not yet exist. - Mututally exclusive with C(enabled). - Considered if C(state=present). required: false enabled: description: - Whether the job should be enabled or disabled. - Mututally exclusive with C(config). - Considered if C(state=present). required: false password: description: - Password to authenticate with the Jenkins server. required: false
enabled: description: Whether the jenkins job is enabled or not. returned: success sample: true type: bool name: description: Name of the jenkins job. returned: success sample: test-job type: string state: description: State of the jenkins job. returned: success sample: present type: string url: description: Url to connect to the Jenkins server. returned: success sample: https://jenkins.mydomain.com type: string user: description: User used for authentication. returned: success sample: admin type: string