From fe6ae51eb8f13b54dfe838cefde148a8a938c4b7 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 10 Dec 2024 10:29:48 -0500 Subject: [PATCH] ansible-vault show how to decrypt strings (#2238) * ansible-vault show how to decrypt strings * izpelll * Update docs/docsite/rst/vault_guide/vault_encrypting_content.rst Co-authored-by: Don Naro * Update docs/docsite/rst/vault_guide/vault_encrypting_content.rst Co-authored-by: Don Naro --------- Co-authored-by: Don Naro (cherry picked from commit 0a84867064efc7453a37aecf86361514e7d7efe4) --- .../vault_guide/vault_encrypting_content.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/docsite/rst/vault_guide/vault_encrypting_content.rst b/docs/docsite/rst/vault_guide/vault_encrypting_content.rst index 3b1ab19bfeb..4ba4ef787f8 100644 --- a/docs/docsite/rst/vault_guide/vault_encrypting_content.rst +++ b/docs/docsite/rst/vault_guide/vault_encrypting_content.rst @@ -286,6 +286,25 @@ If you have an encrypted file that you no longer want to keep encrypted, you can ansible-vault decrypt foo.yml bar.yml baz.yml +.. _decrypting_strings: + +Decrypting encrypted strings +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you just want to check the content of an encrypted string you can also view it by passing it via stdin: + +.. code-block:: bash + + echo -e '$ANSIBLE_VAULT;1.1;V2\neyJrZXkiOiAiZ0FBQUFBQm5UYzlPUVgzeUc5NFo3R2pzYVNMSXVsdXA3Z0paMmczNVRtS0NqMUcwMTVx\nSU1JVDlJZlRrSXBkVThmLXhKS00xZGl6X3F3YXZmWWUteGJWaHNZZXZNWl9hMWZvLVRYM3ZUZDRvaHRR\nWkhIdkJmZEZWNlBwVjhNVjJFT05QbDFwandaazAiLCAiY2lwaGVydGV4dCI6ICJnQUFBQUFCblRjOU9u\nWmM2dDh2VEN5c3NTQVlyV0hMclNEOFZfSGd2eEVHdERCdkJfakFpcUpaWWNTV19sR2hPY0VsWEVweS0z\nQ0NBcmJfdUdsUEt0NzJuSmFxVVVmRFIzdz09In0=' | ansible-vault decrypt + +Alternatively you can use the following command to have Ansible prompt you for input (use Ctrl+D twice to end the input), just like when using ``encrypt_string``: + +.. code-block:: bash + + ansible-vault decrypt + Reading ciphertext input from stdin + + .. _vault_securing_editor: Steps to secure your editor