Skip to content
Advertisement

Why does ansible throws error while encrypting the string?

When I run commands on my ansible 2.9 version on red hat 7 distro –

JavaScript

The first command succeeds while second one fails. Is it related to special characters. My program automatically generates passwords, so just one time escape won’t help!

NB: The BaSh shell also would throw some errors, if you try to pass that string with a tilde using double quotes. But for single quotes, it won’t complain.

Advertisement

Answer

The second command fails because the argument to encrypt_string looks like a command line option (because it starts with hyphen -). As with many command line tools, you can tell ansible-vault to stop looking for option arguments using the -- marker, like this:

JavaScript

The entire process looks like this:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement