community / community.general / 6.6.8 / module / jenkins_job Manage jenkins jobs Authors: Sergio Millan Rodriguez (@sermilrod)community.general.jenkins_job (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Manage Jenkins jobs by using Jenkins REST API.
- name: Create a jenkins job using basic authentication community.general.jenkins_job: config: "{{ lookup('file', 'templates/test.xml') }}" name: test password: admin url: http://localhost:8080 user: admin
- name: Create a jenkins job using the token community.general.jenkins_job: config: "{{ lookup('template', 'templates/test.xml.j2') }}" name: test token: asdfasfasfasdfasdfadfasfasdfasdfc url: http://localhost:8080 user: admin
- name: Delete a jenkins job using basic authentication community.general.jenkins_job: name: test password: admin state: absent url: http://localhost:8080 user: admin
- name: Delete a jenkins job using the token community.general.jenkins_job: name: test token: asdfasfasfasdfasdfadfasfasdfasdfc state: absent url: http://localhost:8080 user: admin
- name: Disable a jenkins job using basic authentication community.general.jenkins_job: name: test password: admin enabled: false url: http://localhost:8080 user: admin
- name: Disable a jenkins job using the token community.general.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 type: str name: description: - Name of the Jenkins job. required: true type: str user: description: - User to authenticate with the Jenkins server. required: false type: str state: choices: - present - absent default: present description: - Attribute that specifies if the job has to be created or deleted. required: false type: str token: description: - API token used to authenticate alternatively to password. required: false type: str config: description: - config in XML format. - Required if job does not yet exist. - Mutually exclusive with I(enabled). - Considered if I(state=present). required: false type: str enabled: description: - Whether the job should be enabled or disabled. - Mutually exclusive with I(config). - Considered if I(state=present). required: false type: bool password: description: - Password to authenticate with the Jenkins server. required: false type: str validate_certs: default: true description: - If set to C(false), the SSL certificates will not be validated. This should only set to C(false) used on personally controlled sites using self-signed certificates as it avoids verifying the source site. - The C(python-jenkins) library only handles this by using the environment variable C(PYTHONHTTPSVERIFY). type: bool version_added: 2.3.0 version_added_collection: community.general
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