Skip to content

Lookup vault file#8110

Closed
bcoca wants to merge 2 commits intoansible:develfrom
bcoca:lookup_vault_file
Closed

Lookup vault file#8110
bcoca wants to merge 2 commits intoansible:develfrom
bcoca:lookup_vault_file

Conversation

@bcoca
Copy link
Member

@bcoca bcoca commented Jul 13, 2014

now the file lookup plugin will automatically decrypt vault files, it should also be easy to add vault support to other lookups using this.

example:

- hosts: localhost
  connection: local
  tasks:
    - name: "Show secret stuff"
      debug: msg="{{ lookup('file', 'files/secret_stuff') }}"

    - name: "non secret stuff"
      debug: msg="{{ lookup('file', 'files/not_secret') }}"

output of : ansible-playbook -i 'localhost,' test.yml

PLAY [localhost] ************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [Show secret stuff] ***************************************************** 
ok: [localhost] => {
    "msg": "$ANSIBLE_VAULT;1.1;AES256\n39623566663433343066313837336334663830616434343631383366353461353666303336316165\n3563656235663731363464643137316662376631373430380a623736323765663637363734306133\n62313933636265643263333564653533626135653162613235623232623334663638373238626462\n3933366466336162610a363934316333373034326665656663306333373736333163373763316666\n65666432663037663432663031356636343063356339343232623435386632636430"
}

TASK: [non secret stuff] ****************************************************** 
ok: [localhost] => {
    "msg": "notsecret1\nnotsecret\n"
PLAY RECAP ******************************************************************** 
localhost                  : ok=3    changed=0    unreachable=0    failed=0   
}

output of : ansible-playbook -i 'localhost,' test.yml --ask-vault-pass

PLAY [localhost] ************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [Show secret stuff] ***************************************************** 
ok: [localhost] => {
    "msg": "secret1\nsecret2\n"
}

TASK: [non secret stuff] ****************************************************** 
ok: [localhost] => {
    "msg": "notsecret1\notsecret2\n"
}
PLAY RECAP ******************************************************************** 
localhost                  : ok=3    changed=0    unreachable=0    failed=0  

@raboof
Copy link

raboof commented Aug 6, 2014

Looks very useful!!

Fixed the merge conflict and opened #8472

@bcoca
Copy link
Member Author

bcoca commented Aug 9, 2014

rebased and pushed branch

@bcoca
Copy link
Member Author

bcoca commented Aug 9, 2014

moved this to clean PR at #8533

@bcoca bcoca closed this Aug 9, 2014
@soichih
Copy link

soichih commented Jan 8, 2015

Which version of Ansible was this feature released in? I am using 1.8.2 (RHEL6 latest) but it's not working.

@raboof
Copy link

raboof commented Jan 8, 2015

It wasn't - this PR was closed without merging, #8533 is the new one but it's outdated and still open :(

@vperron
Copy link
Contributor

vperron commented Apr 16, 2015

Please :) could you merge that ?

@rvdbogerd
Copy link

+1 would be awesome to have this

@flmmartins
Copy link

This is not working with 1.7.2. I am using the exact lines with roles.

@raboof
Copy link

raboof commented May 12, 2015

@flmmartins The PR proposes a feature that has not made it into Ansible yet, so indeed it is not available in 1.7.2.

@abourget
Copy link
Contributor

abourget commented Jul 8, 2015

knock knock knock ! +1 +1 !

@adeck
Copy link

adeck commented Jul 27, 2015

This was opened over a year ago.
And then moved to a new ticket.

Which was squashed; utterly and completely.
Vaults aren't all that useful for a project of any kind of size without the ability to vault files.

😞

@therealmarv
Copy link

@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_pull_request labels Mar 4, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

feature This issue/PR relates to a feature request. P2 Priority 2 - Issue Blocks Release

Projects

None yet

Development

Successfully merging this pull request may close these issues.