This repository contains the following:
Create a credentials
file in the terraform
folder that has the same format as the credentials.example
file. Add the access key id and secret key of the account you want to set up the infrastructure in to the credentials
file.
Run terraform from within the terraform
folder: terraform init
, terraform plan
and terraform apply
.
Update the ansible/hosts
file with the IP address or host name of the newly created EC2 instance using Terraform.
Update the hosts
property in ansible/playbook.yml
to use the host you just added in the previous step.
Ensure that you have an SSH key pair set up to access the EC2 instance. Update the script run_playbook.sh
with your private key file name after the --key-file
property.
Execute the script run_playbook.sh
to run the playbook against the EC2 instance.
To run the playbook locally against a Vagrant box, update the ansible/playbook.yml
playbook to use the host default
and execute the following command:
$ ansible-playbook ansible/playbook.yml -i ansible/hosts
The default
host has all the necessary parameters to connect to the Vagrant box created using the Vagrantfile in this repository.
Note: you might have to update the path to the SSH key required to connect to the Vagrant box in the ansible/hosts
file.