# ansible-vault edit changes sha1 of file even when edits are not saved

**URL:** <https://forum.ansible.com/t/ansible-vault-edit-changes-sha1-of-file-even-when-edits-are-not-saved/16912>\
**Category:** Ansible Project\
**Created:** [November 28, 2014, 1:42pm UTC](https://forum.ansible.com/t/ansible-vault-edit-changes-sha1-of-file-even-when-edits-are-not-saved/16912 "2014-11-28T13:42:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_McMahon](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@Jim\_McMahon](https://forum.ansible.com/u/Jim_McMahon)\
**Post date:** [November 28, 2014, 1:42pm UTC](https://forum.ansible.com/t/ansible-vault-edit-changes-sha1-of-file-even-when-edits-are-not-saved/16912/1 "2014-11-28T13:42:04Z")

</div>

I want to view a file that has been encrypted with ansible-vault, but I don’t want to make any changes. The ansible-vault command doesn’t have an option to just _cat_ the decrypted file. Here are the options available:

➜ defaults git:(master) ✗ ansible-vault --help  
Usage: ansible-vault [**create|decrypt|edit|encrypt|rekey]** [–help] [options] file\_name

Options:  
-h, --help show this help message and exit

See ‘ansible-vault --help’ for more information on a specific command.

So I’ve been using ansible-vault edit command to view the file and then quit the editor without saving when done viewing the contents. Surprisingly, even though I quit out of the editor without saving, it changes the file anyway. Why is this? When I do a git status I see the file is modified and the SHA1 has been changed. See below for an example where no changes were saved:

➜ defaults git:(master) openssl sha1 main.yml

SHA1(main.yml)= 63acb6f65ae7d1ad34e047e80acd8857ebab5692

➜ defaults git:(master) ansible-vault edit main.yml

Vault password:

➜ defaults git:(master) ✗ openssl sha1 main.yml

SHA1(main.yml)= 7c48df4f13402558c0e1ca691250a0e8be0bc548

---

<div class="post-metadata">

**Author:** ![ramon](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@ramon](https://forum.ansible.com/u/ramon)\
**Post date:** [November 28, 2014, 7:57pm UTC](https://forum.ansible.com/t/ansible-vault-edit-changes-sha1-of-file-even-when-edits-are-not-saved/16912/2 "2014-11-28T19:57:46Z")

</div>

Ansible vault actually supports the ‘view’ command, since two days ago (version 1.8).  
There’s also a pull request to update the docs on the website to reflect this.

- Ramon

---

<div class="post-metadata">

**Author:** ![Jim\_McMahon](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@Jim\_McMahon](https://forum.ansible.com/u/Jim_McMahon)\
**Post date:** [November 29, 2014, 12:49am UTC](https://forum.ansible.com/t/ansible-vault-edit-changes-sha1-of-file-even-when-edits-are-not-saved/16912/3 "2014-11-29T00:49:16Z")

</div>

Thanks Ramon.

The **ansible-vault view** command that’s included with version 1.8 is just what I’m looking for. Still I find it surprising that ansible-vault edit command with no saved editor modifications still changes the SHA-1 of the file. But at least I’m aware of this possibility.
