Install and configures Consul as a server or agent, can optionally setup DNS resolution vis Dnsmasq.
The easiest installation method is via Ansible Galaxy:
ansible-galaxy install lobsterdore.ansible-consul
In requirements file:
---
# requirements.yml
- src: lobsterdore.ansible-consul
version: v1.0.0
To see available versions please check this roles Ansible Galaxy page.
Example single server setup:
---
dependencies:
- role: ansible-consul
become: yes
consul_settings:
bootstrap: false
bootstrap_expect: 1
datacenter: "aws-eu-west-1"
leave_on_terminate: true
log_level: "warn"
rejoin_after_leave: true
retry_join: []
server: true
Example agent setup:
---
dependencies:
- role: ansible-consul
become: yes
consul_settings:
datacenter: "aws-eu-west-1"
leave_on_terminate: true
log_level: "warn"
rejoin_after_leave: true
ports: {}
retry_join:
- consul.server
server: false
consul_use_as_nameserver: yes
Enable AWS discovery via tags:
---
dependencies:
- role: ansible-consul
become: yes
consul_aws_ips_autodiscover_enabled: true
consul_aws_ips_autodiscover_lookup_filter: "Name=tag:Env,Values=prd Name=tag:Role,Values=consul_server Name=instance-state-name,Values=running"
consul_settings:
bootstrap: false
bootstrap_expect: 1
datacenter: "aws-eu-west-1"
leave_on_terminate: true
log_level: "warn"
rejoin_after_leave: true
retry_join: []
server: true
This role uses two tags: build and configure
build
- Installs packages, can be used to bake AMIsconfigure
- Configures packages, can be used on boot for pre-baked AMIs
A Vagrant box is included that you can use to test this role, a Makefile is included as well that contains some useful targets for testing, to see a list of targets you can do the following:
make
If you would like to contribute to this role please open a Github issue first, then open your PR and reference the issue.