consul-vault-haproxy
Ansible playbooks that install and configure Vault with Consul backend-- behind HAProxy.
Notes
- This demo requires
Vagrant
andVirtualBox
. - The consul encryption key is hardcoded in ansible-vault.
- Initializing and unsealing the vault is a manual step.
- Vagrant assumes your public key is available at ~/.ssh/id_rsa.pub
Instructions
Prepare the env
- run
make setup
to install vagrant-hostmanager and generate the encryption key for Ansible vault.
Setup a HAProxy loadbalancer
- run
ENV=vagrant make build-proxies
Prepare hosts to become consul servers
- run
make start-vms
to start vagrant boxes and setup /etc/hosts. - run
ENV=vagrant make build-consul-servers
to install base packages and consul on the hosts
Bootstrapping and clustering Consul
- run
ENV=vagrant make bootstrap-consul
to deploy the bootstrap config to the host and start consul in bootstrapped mode. - run
ENV=vagrant make cluster-consul
to generate the server configs and have the consul servers join together to form a more perfect union. - run
ENV=vagrant make verify-cluster
to check consul membership. You should see all three servers listed.
Setup Consul clients and Vault servers
- run
ENV=vagrant make buid-vault-servers
Initializing and unsealing vaults
- On one of the vault machines, run the following command to initialize the vault. Upon initialization, Vault will return the unsealing keys and the master token.
vault operator init
- Each vault requires three keys to unseal. Each vault must be unsealed individually.
vault unseal <key$>
Author and License
Copyright (c) 2021 Shey Sewani, MIT License