Giter Club home page Giter Club logo

Comments (6)

rseabra avatar rseabra commented on August 20, 2024 1

~~There is a typo that nobody noticed. It's ANSIBLE_VAULT_PASSWORD_FILE! ~~ I'm off work and without access to my setup in order to checkout if there's an actual typo, because I'm almost 100% sure that the point was to load the password into a variable, and not a file that's not actually available in the container.

I'll let you know next week.

from ansible-navigator.

rseabra avatar rseabra commented on August 20, 2024 1

Thanks a lot for finding out my error in the documentation patch, it's a neat trick and it deserves to be properly documented. :)

from ansible-navigator.

netopsengineer avatar netopsengineer commented on August 20, 2024

@rseabra it looks like you introduced this documentation on #1714 could you comment on how it is to be used? From everything I can gather, there is no support for ANSIBLE_VAULT_PASSWORD as an env var from Ansible, it doesn't look for it, in fact it seems it was proposed, and the PR was rejected here ansible/ansible#64383 (comment)

Any help would be appreciated.

from ansible-navigator.

netopsengineer avatar netopsengineer commented on August 20, 2024

@rseabra appreciate the reply, yeah I figured that might be the case, but even then I was not sure how it would work, as ANSIBLE_VAULT_PASSWORD_FILE expects a path, and if I'm following the instructions properly in the README, this would essentially set the output of gpg --decrypt eg. the plaintext password as the value of ANSIBLE_VAULT_PASSWORD_FILE in the EE, which will not work.

You essentially need a file with the output of gpg ... as the contents AFAIK. The challenge is that you would need to symlink your .asc file into the project for it to be able to execute it in the EE, much like the current directions in the README do today.

If you were able to work around this, or this is some gpg-agent trick (I am new to working with gpg in this context), I would love to hear about it, and we can decide the best way to do a PR to update the docs to explain it better, and fix the typo.

from ansible-navigator.

rseabra avatar rseabra commented on August 20, 2024

"&%$#"%$#&"# I documented it wrong, I will fix the faq but here's the proper trick:

mylogin@myhost:~$ export ANSIBLE_VAULT_PASSWORD_FILE=~/bin/ansible-vault.sh
mylogin@myhost:~$ cat $ANSIBLE_VAULT_PASSWORD_FILE
#!/bin/sh

/usr/bin/gpg -q -d /.../vault.asc

mylogin@myhost:~$ cat ansible-vault.sh
#!/bin/sh

echo $ANSIBLE_VAULT_PASSWORD

mylogin@myhost:~$ cat zbr.yaml
- hosts: localhost
  vars:
    secret: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          37393239346661666331316663356662366262383732396237313939366666663733656439333265
          3661636531633338306135326235643534656635333665310a343261643432303165633864666131
          32343637336366356234633839346430346639623961646434356330393263313433346134386436
          3236613664636235360a653834393430353938666164396663643537636665623930623339323865
          6336
  tasks:
    - debug:
        var: secret
mylogin@myhost:~$ ansible-playbook zbr.yaml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

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

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [debug] *********************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "secret": "Segredo!"
}

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

mylogin@myhost:~$ ANSIBLE_VAULT_PASSWORD=$( $ANSIBLE_VAULT_PASSWORD_FILE ) ansible-navigator run -m stdout --eei registry.redhat.io/ansible-automation-platform/ee-minimal-rhel9:2.15.11-2 --senv=ANSIBLE_VAULT_PASSWORD_FILE=ansible-vault.sh --penv=ANSIBLE_VAULT_PASSWORD zbr.yaml
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'

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

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "secret": "Segredo!"
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

from ansible-navigator.

rseabra avatar rseabra commented on August 20, 2024

I added #1799 in order to resolve.

from ansible-navigator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.