I have such config for ansible:

- hosts: localhost
  connection: local
          - name: Jenkins - add job
                    config: "{{ lookup('file', 'jenkins_conf/pipeline_staging.xml') }}"
                    name: deploy-staging
                    password: XXXXX
                    url: https://jenkins.url.com
                    user: someuser

But when i try to start this playbook i'm getting:

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Unable to validate if job exists, HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.\nThe last 30x error message was:\nFound for https://jenkins.url.com"} to retry, use: --limit @/home/holo/project/sources/devops/orchiestration/environment-cloud/ansible-playbook/jenkins.retry

What am i doing wrong?

  • Is your Jenkins behind a proxy? And if so does the error occurre when connecting directly to the jenkins server? – Henrik Pingel Jun 9 '17 at 12:46
  • It is behind kubernetes ingress resource (google cloud platform): kubernetes.io/docs/concepts/services-networking/ingress So as it is on kubernetes i can't connect to it directly. – user3069488 Jun 9 '17 at 13:17
  • I checked with my other Jenkins instance (instaled on VM not in containers) with direct access and Ansible is working in that case. Is there possibility to use Ansible Jenkins plugin with app behind proxy? – user3069488 Jun 9 '17 at 13:39
  • I guess so, the proxy you have configures is just seems to be not working properly. I would try to setup proxy-to-service. – Henrik Pingel Jun 9 '17 at 14:27
  • Hmm.. but this is another service which i need to expose with another ingress, so situation will be same like in my present configuration. Right now Jenkins pod is made same way. – user3069488 Jun 9 '17 at 15:01

The proxy in front of the Jenkins server seems to be wrongly configured. However as the jenkins_job module is executed on the remote host this problem can be avoided by not using connection: local and setting the url parameter to localhost:jenkins_port.

  • It is Kubernetes cluster and service is accessible by ingress IP. Executing it on remote host still will be connecting via ingress/proxy resource. PS as suggested i added tags and changed description instead of creating new question – user3069488 Jun 10 '17 at 10:19
  • I created additional nat instance and executed plugin remotely with direct connection to kubernetes endopoint (without ingress/LB). Still did not help. Same error like above. Looks like plugin is not working when Jenkins is installed on top of docker/kubernetes. – user3069488 Jun 12 '17 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.