This reposiory will help you setup Consul Cluster (2 clients and 3 Servers) using Terraform and Ansible.
Please refer to file - client-setup-script.sh
chmod 777 client-setup-script.sh
./client-setup-script.sh
git clone https://github.com/dhavlev/consul-terransible.git
cd consul-terransible/terraform
terraform init
terraform plan
terraform apply --auto-approve
terraform destroy --auto-approve
ansible-playbook -i non-production master-install-consul.yaml --tags "setup"
ansible-playbook -i non-production master-install-consul.yaml --tags "consul-start" | "consul-stop" | "consul-status"
- ansible the authenticity of host can't be established
Open /etc/ansible/ansible.cfg and set 'host_key_checking' to false - Problem while identing the config.json
refer to link
- This infrastructure is deployed from a controller machine which is outside the Consul Infra and does not have access to private IPs.
- You will see Public IPs are enabled though Instances are deployed in Private Subnet.
- Please amend scripts to suit your requirements.
- Remove route to internet from route - "consul_rt_private"
- Remove "map_public_ip_on_launch" from "consul_sub_private_a", consul_sub_private_b", "consul_sub_private_c"
- Map private ips in ansible inventoty "aws_hosts"