Reputation: 31
I'm looking for a solution where I want to trigger a Jenkins build through Ansible.
I went through a module called jenkins_job from which I can connect to the jenkins server but not able to trigger a new build.
Upvotes: 3
Views: 6451
Reputation: 1324657
Alternatively, you could use the uri_module
:
- name: Queue build of a project in Jenkins
uri:
url: "http://{{ jenkins.host }}/job/{{ jenkins.job }}/build?token={{ jenkins.token }}"
method: POST
user: "{{ jenkins.user }}"
password: "{{ jenkins.password }}"
force_basic_auth: yes
status_code: 201
That does use the Jenkins Remote access API
Upvotes: 4