Go package to read/write Ansible Vault secrets
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor Save deps and add Makefile Nov 12, 2018
Gopkg.lock Save deps and add Makefile Nov 12, 2018
Gopkg.toml Save deps and add Makefile Nov 12, 2018
Makefile Save deps and add Makefile Nov 12, 2018
README.md Badges Nov 12, 2018
crypt.go Replace error Nov 20, 2018
key.go Add key test Nov 26, 2018
key_test.go Add key test Nov 26, 2018
secret.go Validate secret format Nov 12, 2018
vault.go Only require vault password, add extra tests Dec 5, 2018
vault_test.go Only require vault password, add extra tests Dec 5, 2018

README.md

ansible-vault-go

Go package to read/write Ansible Vault secrets

GoDoc Go Report Card

Installation

go get github.com/sosedoff/ansible-vault-go

Usage

package main

import(
  "log"

  "github.com/sosedoff/ansible-vault-go"
)

func main() {
  // Encrypt secret data
  str, err := vault.Encrypt("secret", "password")

  // Decrypt secret data
  str, err := vault.Decrypt("secret", "password")

  // Write secret data to file
  err := vault.EncryptFile("path/to/secret/file", "secret", "password")

  // Read existing secret
  str, err := vault.DecryptFile("path/to/secret/file", "password")
}

Doc

Check out the Ansible documentation regarding the Vault file format:

License

MIT