ansible / ansible.builtin / v2.9.27 / 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.9.27) — module
pip
Install with pip install ansible==2.9.27
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. - Mutually exclusive with C(enabled). - Considered if C(state=present). required: false enabled: description: - Whether the job should be enabled or disabled. - Mutually exclusive with C(config). - Considered if C(state=present). required: false type: bool 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: 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