You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
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
bug... or just documentation error (see bottom)
COMPONENT NAME
ansible-vault encrypted_string
ANSIBLE VERSION
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/usr/share/ansible', u'/opt/ansible/roles']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]
OS / ENVIRONMENT
centos 7.4
SUMMARY
using echo and pipe to generate a vaulted value appends '\n' to the value
STEPS TO REPRODUCE
[rmullen@ vault-test]$ echo "123" | ansible-vault encrypt_string --vault-id vault-password --stdin-name 'mysecret'
Reading plaintext input from stdin. (ctrl-d to end input)
mysecret: !vault |
$ANSIBLE_VAULT;1.1;AES256
65313037646666333934396462623561626630313062636632393035633966393133616637393166
6437643932353634336436663865666462386539326238330a653339383337353336303530363764
65386162633530353363346561333738323839613164356166356136306161366235323061343239
3031333834666335630a313765346436666634373331353335313539316463633864653438323433
Encryption successful
here is the output when i run debug var using this
TASK [debug] ************************************************************************************************************
ok: [rskapdvl1.pxlabus.com] => {
"mysecret": "123\n"
EXPECTED RESULTS
"123"
you could also fix this by updating the documentation
here
to use
echo -n "123" | ansible-vault ...
according to this [reddit post] (
https://www.reddit.com/r/ansible/comments/6kzslm/ansiblevault_encrypt_string_appends_n/djq0n0a/
) which also worked for me
Files identified in the description:
If these files are inaccurate, please update the
component name
section of the description or use the
!component
bot command.
click here for bot help
Vault is not appending the newline, your use of echo is causing the newline.
You will need to use
echo -n
to prevent echo from adding the newline to your data. Vault should not be responsible for stripping newlines, as the newlines could be desired.
If you have further questions please stop by IRC or the mailing list:
IRC: #ansible on irc.freenode.net
mailing list:
https://groups.google.com/forum/#!forum/ansible-project
Hi thanks
@sivel
I know that fixes the issue, i wrote that at the bottom of my issue ticket. However, if thats the intended usage, then the ansible docs need to be updated
From the bottom of my write up:
you could also fix this by updating the documentation
here
to use echo -n "123" | ansible-vault ... according to this [reddit post] (
https://www.reddit.com/r/ansible/comments/6kzslm/ansiblevault_encrypt_string_appends_n/djq0n0a/
) which also worked for me