title: Launch Ansible playbook containing vault file reference from jenkinsfile
body: <p>I have a Jenkinsfile trying to launch an Ansible playbook which references some parameters stored in an Ansible vault encrypted file.</p>
  
  <p>Ansible is installed in version 2.4.0.0</p>
  
  <p>Here is a snippet of my jenkins file:</p>
  
  <pre><code>withCredentials([[$class: 'StringBinding', credentialsId: 'vault_token', variable: 'VAULT_TOKEN']]) {
  
                      ansiblePlaybook(
                              playbook: "./ansible/playbooks/deploy.yml",
                              inventory: "./ansible/hosts/hosts",
                              credentialsId: "$VAULT_TOKEN"
                  }
  </code></pre>
  
  <p>And there is the playbook:</p>
  
  <pre><code>---
  - hosts: managers
    become: true
    tasks:
    - include_vars: ../vaults/passwords.yml
    - name: Log into Docker repository
      docker_login:
        registry: my.registry.org
        username: "{{ reg_user }}"
        password: "{{ reg_password }}" 
  </code></pre>
  
  <p>This playbooks includes the vault file containing the encrypted values.
  When Jenkins execute the Jenkinsfile, I get the following error:  <strong><em>Attempting to decrypt but no vault secrets found</em></strong></p>
  
  <p>Why is ansible not using the credentialId i've passed to him in the Jenkinsfile and what is the good way to pass this credential?</p>