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

Ansible Plugin not working using password authentication

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • ansible-plugin
    • None
    • Jenkins ver. 2.89.2
      Ansible-Plugin v0.8
      Redhat 7
    • 231.va_d0cb_802c621

      When trying to use the Ansible plugin, the SSH request is being rejected due to invalid password. However, when taking the same command and running it through "sh" Jenkins pipeline step OR directly running it in Bash, the password is accepted and the playbook execution is successful. 

      One thing to note is the password contains "$$". This is also a problem for ansible-plugin as the prependPasswordCredentials method in AbstractAnsibleInvocation.java does not quote the password. I assumed this was the only problem, fixed it and was going to submit a PR once validated, but I am still encountering issue reported when testing my modified code. 

       

      Example of running playbook through ansible plugin

      [Ansible_Test] $ sshpass -p 'P@$$word' ansible-playbook /etc/ansible/ping.yml -i /etc/ansible/environment/stg -u ansible -k -vvv
      //This fails and sshpass returns invalid password

      Example of running playbook using Jenkins "sh" step 

      [Ansible_Test] Running shell script
      + sshpass -p 'P@$$word' ansible-playbook /etc/ansible/ping.yml -i /etc/ansible/environment/stg -u ansible -k -vvv
      //This works as expected

      Username and Password have been changed but the password reflects the uniqueness of the situation. Output in Jenkins has also been unmasked for testing purposes. 

       

            jonesbusy Valentin Delaye
            forestoden6 Forest Oden
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: