This repository is a example how using using Terraform and Ansible.
Terraform is using to create immutable EC2 instance on AWS and Ansible to install and configure HAProxy.
- Install:
Run Terraform:
terraform init --backend-config="access_key=XXX" --backend-config="secret_key=YYY"
terraform workspace new dev-env
terraform apply
Run Ansible playbook:
sh ansible_runner.sh ~/.ssh/id_rsa terraform/ dev-env ansible/haproxy.yml
It is possible to test Ansible scripts locally with use Vagrant.
cd ansibble/
ansible-galaxy install -r requirements.yml
vagrant up
Or if the machine is running then the Ansible changes can be tested using only
vagrant provision