Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46912

Jenkins - Ansible ssh credential issue after first run from application

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ansible-plugin
    • Tested in both CentOS VM, RHEL container and Ubuntu container versions of Jenkins. Fresh latest installs for each flavor.

      Ansible 2.2.x and Ansible 2.3.x (Haven't tried anything earlier).

      From the jenkins application (web UI)

      An odd issue would occur when the first Ansible playbook from Jenkins would succeed and subsequent runs would fail. Rebuilding the container environments would produce the same result.

      From the CLI 

      Running the Playbook from the command-line works consistently, as long as the application (web ui) had not already been run. As soon as the webUI runs, both will fail and the container needs to be rebuilt.  

       

      Testing Notes

      Once the webUI had executed the task successfully once and then failed each subsequent run: 

      Testing with Ansible 2.2, and SSH debugging enabled on the host machine would show connection details but failed on authentication  (forcing key even though sshpass was specified or manually inut). 

      Testing with Ansible 2.3 absolutely NO attempt was made to ssh to the host machine based on zero debug logs on the host machine. 

       

      The Workaround

      While the full root cause isn't yet known, it's clear that the jenkins application is writing some garbage into ~/.ansible after the first successful playbook run that needs to be cleared out with each job. 

      Adding the following script as a beginning stage to each job is the current workaround. 

      ` rm -rf ~/.ansible/* `

       

       

       

            sirot Jean-Christophe Sirot
            stewartshea Shea Stewart
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: