Jan Veen 0ecd41ed5f | ||
---|---|---|
pkg/Archlinux | ||
.gitignore | ||
LICENSE | ||
README.md | ||
ansible-vault |
README.md
Ansible vault git integration
Enable displaying diffs and merging ansible vaults in git.
Interactive password input is not supported
Installation
-
Copy the
ansible-vault
script toyour_script_directory
-
Configure git to use the script by adding this to
~/.gitconfig
or.git/config
(projectwise):
[diff]
tool = ansible-vault
[difftool "ansible-vault"]
cmd = your_script_directory/ansible-vault diff \"$REMOTE\" \"$LOCAL\" \"$MERGED\" \"$BASE\"
[diff "ansible-vault"]
command = your_script_directory/ansible-vault diffdriver
[merge]
tool = ansible-vault
[mergetool "ansible-vault"]
cmd = your_script_directory/ansible-vault merge \"$REMOTE\" \"$LOCAL\" \"$MERGED\" \"$BASE\"
Now the tool is available in git difftool
and git mergetool
.
- (Optional) To enable inline support for
git diff
tell git how to generate diffs for your files. Create a.gitattributes
file in the git root directory and mark the vault files as diffable, e.g.:*_vault.yml diff=ansible-vault
.
Merging files
When using the script as mergetool make sure to merge to the RIGHT direction.
Finding your ansible.cfg
The script looks for your ansible configuration file to resolve vault ids and
secret locations. When diffing root/bar/tool_vault.yml
the script probes
root/bar/ansible.cfg
and root/ansible.cfg
for your actual file. If none is
found it asks for a path interactively.