-
Notifications
You must be signed in to change notification settings - Fork 23
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
SOPS collection doesn't see environment variables set with Ansible environment keyword at the task level. #46
Comments
|
Thanks. Would the plugin work with EC2 attached role if our controller is the EC2 host on which we execute Ansible playbook and try to decrypt secret with a role? Or would it still expect profile with keys in ~/.aws/credentials?
|
Right now you either need to set the env variables before running ansible-playbook, or you need to use other configuration methods available by sops. I've discussed this a bit on #ansible-devel, the best resolution is probably to add module options for all sops configurations and pass them on to the sops call. I'll work on that soon, but not today :) |
Thanks for getting back. This would be very nice feature. For the time being will go with AWS profile as I know it is working. |
Your problem should be solved by #47. |
Hello @ckarwicki, looking at your question
I would say it works out of the box, as confirmed in this mozilla/sops issue. Please note that there are some issues related to AWS profile and roles decrypting (see getsops/sops#474 and getsops/sops#634) |
Thanks. It is very helpful. Also, I found that when host assumes role that has access to KMS then sops plugin can be just executed from it and it will have access to KMS - you don't need to provide AWS keys in environment variables or in AWS profile. sops takes it from STS credentials the host gets when it assumes role. |
I would close this as solved, work on #47 will continue. |
SUMMARY
SOPS collection doesn't see environment variables set with Ansible environment keyword at the task level.
ISSUE TYPE
COMPONENT NAME
community.sops.load_vars
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
CentOS Linux 7 (Core), Linux 3.10.0-1127.10.1.el7.x86_64
STEPS TO REPRODUCE
A role with a community.sops.load_vars and environment keyword.
EXPECTED RESULTS
community.sops.load_vars should use provided environment variables and decrypt secret with KMS key.
ACTUAL RESULTS
community.sops.load_vars throws error that access is denied to the key. However same task works if ~/.aws/credentials is present:
[defualt]
AWS_ACCESS_KEY_ID=<>
AWS_SECRET_ACCESS_KEY=<>
So it looks community.sops.load_vars cannot see environment variables set with environment keyword. sops executable works with environment variables:
AWS_ACCESS_KEY_ID=<> AWS_SECRET_ACCESS_KEY=<> sops --kms "arn:aws:kms:..." -d roles/my-role/dev-secrets.yml
The text was updated successfully, but these errors were encountered: