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

ansible plugin does not use "private" credentials

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ansible-plugin
    • None
    • Jenkins 2.6.3
      ansible-plugin 0.6.2
      credentials-plugin 2.1.14

      on a linux box

      I'm trying to pass a "private" credentialsId (in "Stores scoped to User: my_login", as opposed to the global credentials store) to the ansible plugin with a pipeline likeĀ 

      pipeline {
          agent any
          stages {  
              stage('ssh-ansible-test') {                                                                                                                                                                                                                                                     
                  steps {                                                                                                                                                                                                                                                             
                      wrap([$class: 'MaskPasswordsBuildWrapper']) {                                                                                                                                                                                                                   
                          ansiColor('xterm') {                                                                                                                                                                                                                                        
                              timestamps {
                                  ansiblePlaybook(                                                                                                                                                                                                                                    
                                      [                                                                                                                                                                                                                                               
                                          colorized: true,                                                                                                                                                                                                                            
                                          credentialsId: "MY_PRIVATE_SSH_KEY",                                                                                                                                                                                                      
                                          inventory: 'hosts',                                                                                                                                                                                                   
                                          playbook: 'test.yml'                                                                                                                                                                                                                
                                      ]                                                                                                                                                                                                                                               
                                  )
                              }                                                                                                                                                                                                                                                       
                          }                                                                                                                                                                                                                                                           
                      } 
                  }
              }                                   
          }
      }
      

      but keep getting

      fatal: [my.machine.fqdn]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password,keyboard-interactive).\r\n", "unreachable": true}
      

      When I do the same with a globally scoped credentialId, it works ok.

      Could it be that ansible-plugin does not have access to these credentials and if so, could this be changed please?

      I'd like to be able to make sure a logged-in-user uses his/her own private ssh key to run ansible on target machines.

            michaelcresswell Michael Cresswell
            svenxy Sven Hergenhahn
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: