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

ansible plugin does not use "private" credentials

    Details

    • Type: Bug
    • Status: In Progress (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: ansible-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.6.3
      ansible-plugin 0.6.2
      credentials-plugin 2.1.14

      on a linux box
    • Similar Issues:

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: