Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookup vault file #8110

Closed
wants to merge 2 commits into from
Closed

Lookup vault file #8110

wants to merge 2 commits into from

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 raboof commented Aug 6, 2014

Looks very useful!!

Fixed the merge conflict and opened #8472

@bcoca
Copy link
Member Author

@bcoca bcoca commented Aug 9, 2014

rebased and pushed branch

@bcoca
Copy link
Member Author

@bcoca bcoca commented Aug 9, 2014

moved this to clean PR at #8533

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

@soichih 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 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 vperron commented Apr 16, 2015

Please :) could you merge that ?

@rvdbogerd
Copy link

@rvdbogerd rvdbogerd commented May 11, 2015

+1 would be awesome to have this

@flmmartins
Copy link

@flmmartins flmmartins commented May 11, 2015

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

@raboof
Copy link

@raboof 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 abourget commented Jul 8, 2015

knock knock knock ! +1 +1 !

@adeck
Copy link

@adeck 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.

😞

@ansibot ansibot added feature 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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

You can’t perform that action at this time.