Ansible - jenkins plugin failing on Google Container Engine (GKE) - infinite loop with ingress

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?


Solution 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.