Giter Site home page Giter Site logo

celdevelopment / ansible-certificates-from-vault Goto Github PK

View Code? Open in Web Editor NEW

This project forked from netresearch/ansible-certificates-from-vault

0.0 0.0 0.0 24 KB

Fetch SSL/TLS certificates from Hashicorp's Vault and store them on a host's filesystem.

Home Page: https://galaxy.ansible.com/netresearch/certificates_from_vault

License: GNU Affero General Public License v3.0

ansible-certificates-from-vault's Introduction

Ansible role: TLS Certificates from Vault

An Ansible role that fetches SSL/TLS certificates and private keys from a Hashicorp Vault KV secrets engine and stores them on a host's file system.

Requirements

Currently supported operating systems:

  • Debian 9
  • Ubuntu 18.04

Role Variables

vault_url: "http://myvault:8200"

The URL to the running Vault service.

vault_path: "secret/certificates"

The path to the folder of the KV secrets engine containing the certificate secrets.

vault_token_string: "{{
  'token=' + VAULT_TOKEN if VAULT_TOKEN is defined and VAULT_TOKEN
  else 'token=' + vault_token if vault_token is defined and vault_token
  else ''
}}"

Vault token parameter that is passed to the hashi_vault lookup plugin. It is not intended to change this variable.

vault_token:

The Vault token for authentication within Vault. It is also possible to specify the token within the VAULT_TOKEN environment variable.

vault_secret_cert_keyname: "cert"

The name of the key that contains the certificate (public key) within the Vault secret.

vault_secret_key_keyname: "key"

The name of the key that contains the private key within the Vault secret.

cert_dest_dir: "/etc/ssl/private"

File path to the directory on the host where certificates will be stored.

certificates:

List of secret names stored beneath vault_path containing fields for cert and private key.

Dependencies

This role does not depend on any other role from the Ansible Galaxy.

Example Playbook

    - hosts: servers
      vars:
        vault_url: "http://myvault:8200"
        vault_path: "secret/certificates"
        certificates:
          - www.example.org
          - web1.example.org
      roles:
         - netresearch.certificates_from_vault

Note: It is assumed that the certificates are available as secrets in Vault at secret/certificates/www.example.org and secret/certificates/web1.example.org.

Local testing

The preferred way of locally testing the role is to use Docker. You will have to install Docker on your system.

For all our tests we use test-kitchen with InSpec. To install test-kitchen for Ubuntu 18.04:

$ sudo apt install ruby ruby-dev
$ sudo gem install test-kitchen inspec kitchen-ansible kitchen-inspec kitchen-docker

Please pass a valid Vault token to kitchen to fetch certificates from from your running Vault instance for testing:

$ export VAULT_TOKEN=s.abcdefghijklmn1234567890

Rename tests/test_vars.yml.dist to tests/test_vars.yml and customized the variables to your needs.

For starting the tests on all machines, please run:

$ kitchen test

For development you can also run the test step-by-step for a particular OS:

# create vagrant boxes
$ kitchen create debian

# rollout Ansible config
$ kitchen converge debian

# start InSpec tests
$ kitchen verify debian

# login into vagrant box
$ kitchen login debian

License

GNU Affero General Public License v3.0

Author Information

Norman Bestfleisch | Netresearch DTT GmbH

ansible-certificates-from-vault's People

Contributors

tripleawwy avatar cybottm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.