There are numerous ways to encrypt and share sensitive information. Projects such as BlackBox , Pass and Ansible Vault do similar things. BlackBox has the added benefit that multiple people can access the sensitive information as long as they are on the same keyring using GPG
As Ansible is used as the main configuration management tool and will be to the tool that’s manipulating the secret / sensitive information it makes sense to try and leverage vault. The issue is that there is still a shared secret / password that needs to be considered. Thanks to John Knight the following post covers off how to combine Ansible, GPG & Git to provide a similar but more integrated solution than Blackbox.
This post will build on that information and add extra background reading.
The rationale for this work is to build a docker container that acts as a Jenkins Slave. It needs to have sensitive information stored inside in order to access git, svn and git etc. This information needs to be stored in the project encrypted
cvspass auth information
svn auth information
builder private key
All this information should be stored inside a vault encrypted file in Ansible. Im using the following structure.
As the ansible playbook is run passing the vault password the content can be simply copied
Makefile
The docker container is built using Make which wraps up all the docker commands and allows the password to be unencrypted.