Use this repository for you to start understand key concepts of Ansible.
- Change profile name in c1-versions.tf
- Configure the instance type, key pair and instance count based on your requirement in ec2instance.auto.tfvars
- Configure aws region in terraform.tfvars
// Deploy the architecture and get IP address for EC2 instances in the output
cd terraform
terraform init
terraform validate
terraform plan
terraform apply -auto-approve
// Destroy the architecture
terraform destroy -auto-approve
Inventory file is the place you configure the servers. Get the public IP from the terraform output and make sure you have the correct key file.
Playbook is the recipe including destination hosts and the automation processes. This example is to install a LAMP stack on and EC2 instance.
ansible-playbook [playbook.yaml] -i [inventory_file]
Tasks include the steps (In order) that Ansible is doing to the hosts.
The modules within tasks we are using in this playbook include:
- yum
- command
- service
- copy
There are tons of modules can be used.
Use ansible role to define the group of actions which can be reused. (This is just my own understanding)
- Variables (with conditions)
- Loops
- Become: True/Yes --> sudo
- Jinja2 template
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.