0

I have such config for ansible:

- hosts: localhost connection: local tasks: - name: Jenkins - add job jenkins_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?

7
  • Is your Jenkins behind a proxy? And if so does the error occurre when connecting directly to the jenkins server? Commented Jun 9, 2017 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. Commented Jun 9, 2017 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? Commented Jun 9, 2017 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. Commented Jun 9, 2017 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. Commented Jun 9, 2017 at 15:01

1 Answer 1

1

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.

2
  • 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 Commented Jun 10, 2017 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. Commented Jun 12, 2017 at 16:50

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.