Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 986 Bytes

README.md

File metadata and controls

41 lines (29 loc) · 986 Bytes

Ansible with Terraform Example

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.

Setup:

  1. Install:

Usage:

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

Development:

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