The purpose of this repo is to provision out a 3-node Consul cluster. The inspiration behind this repo was a ready to roll Consul backend for Terraform.
The following list of assumptions are made but may be adjusted as neccessary.
- Functional vSphere environment including vCenter.
- Ubuntu (preferred) VM template available in vCenter.
- DHCP is available to assign IP addresses to VMs when they spin up.
NOTE: If you need an easy way to provision vSphere templates checkout my repo Packer-For-vSphere-and-More.
Create group_vars/all/accounts.yml
with the following contents (adapt to your
environment):
---
# Defines Linux SSH password
ansible_password: packer
# Defines Linux SSH user
ansible_user: packer
# Defines vCenter password
vcenter_password: VMw@re1!
# Defines vCenter username
vcenter_username: [email protected]
NOTE: The above file is excluded from version control to ensure that account info is not leaked. You can also use
ansible-vault
if needed but you will need to removeaccounts.yml
from.gitignore
.
You will first need to spin up 3 VMs for the Consul cluster. These VMs are to be provisioned in a vSphere environment.
Modify the following to meet your environment requirements:
You also will need to adjust the following for Consul.
group_vars/consul_cluster/consul.yml
:
# Generated using 'uuidgen'
# make sure to generate a new token and replace this one
consul_acl_master_token: 7A993C85-1EA6-412D-85DB-DA14EFCD03AB
# Generate using 'consul keygen'
# make sure to generate a new key and replace this
# also update key if you changed the it in your cluster via 'consul keyring',
# otherwise the role may deploy an outdated key to additional nodes which then
# can't join the cluster
consul_encryption_key: OJVXXkKdwifyqc9BrDe1VQ==
To spin up the VMs:
ansible-playbook provisioned_vms.yml
After the VMs have been provisioned, hosts.inv
will be populated to use as
Ansible inventory.
To provision the VMs:
ansible-playbook -i hosts.inv playbook.yml
MIT
Larry Smith Jr.