-
Notifications
You must be signed in to change notification settings - Fork 22
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
Allow to tell sops lookup to return '' for non-existant files #33
Allow to tell sops lookup to return '' for non-existant files #33
Conversation
Codecov Report
@@ Coverage Diff @@
## main #33 +/- ##
==========================================
+ Coverage 86.29% 86.45% +0.15%
==========================================
Files 6 6
Lines 343 347 +4
Branches 61 62 +1
==========================================
+ Hits 296 300 +4
Misses 32 32
Partials 15 15
Continue to review full report at Codecov.
|
FYI, this is a full example using the new option for the sops lookup and sops_encrypted, together with the new openssl_privatekey_pipe module from community.crypto: https://github.com/felixfontein/ansible-acme/blob/40ed248c7d3b18e604bf6f35aa9d9bdf56377b82/roles/acme_certificate/tasks/main.yml#L71-L101 |
👍 I did something very similar for our internal use in my company, so I'm definitely going to keep an eye on felixfontein/ansible-acme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if it make sense to update the behaviour instead of adding a new one. I don't think it would break compatibility as due to how it is implemented right now (you must perform a stat
before, and with that safe guard you would not run the plugin at all).
What do you think?
Hmm, I'm generally no fan of eating up errors when not explicitly being asked so. For calling roles/playbooks, it would be surprising (IMO) if the Just image if you're writing a private key to a location on the remote server (by combining |
@endorama what do you think of releasing 0.2.0 soon? I'd really like to be able to use this new option without having to install from git (or even from this branch) :) |
@endorama can you be chance look at this PR again? (Maybe even at the others?) It would be really awesome to have this in a release, it's a lot easier to use than installing collections from a git repo branch (which doesn't work for Ansible 2.9). |
@felixfontein I'm sorry for the long delay, but these notifications were buried under others so I missed them.
I pretty much agree with this. From the liked usage in felixfontein/ansible-acme this change would allow using I'm specifically referring to these lines: https://github.com/felixfontein/ansible-acme/blob/40ed248c7d3b18e604bf6f35aa9d9bdf56377b82/roles/acme_certificate/tasks/main.yml#L76-L80 This looks a clean and useful, so I'm definitely ok with the change. I also agree is better to have it under a specific option to explicit the behaviour. |
Exactly. Otherwise you first would have to use a |
@endorama thanks for reviewing this one as well! |
@endorama do you mind if I release a 0.2.0 version of the collection? (Or do you want to do that yourself?) |
Motivation
This makes implementing things a lot easier. Instead of first having to do a stat to see if it really exists, one can simply specify
empty_on_not_exist=true
to the lookup and obtain an empty string instead of an error.I'm using this in https://github.com/felixfontein/ansible-acme/ (I'm right now working on adding sops-encrypted keys support).