- This repository creates EC2 instances using Terraform and sets up a Docker Swarm cluster using Ansible.
- In the
terraform
directory, Terraform is used to create EC2 instances and configure networking. - Ansible is then used to provision the instances and set up the Docker Swarm cluster.
- Finally, a website is deployed on the Docker Swarm cluster.
-
Install Terraform by following the official installation guide.
-
Create a file named
secrets.tfvars
with the following information:aws_acces = "YOUR_AWS_ACCESS_KEY" aws_secret = "YOUR_AWS_SECRET_KEY" cloudflare_api = "YOUR_CLOUADFLARE_API_KEY"
-
Install Ansible by running the following command:
wget -qO- https://raw.githubusercontent.com/voutuk/file/main/an.sh | sudo bash
Note
Please note that you need to replace YOUR_AWS_ACCESS_KEY
, YOUR_AWS_SECRET_KEY
, and YOUR_CLOUADFLARE_API_KEY
with your actual AWS access key, secret key, and Cloudflare API key. The Cloudflare API key should have the necessary permissions to edit zone DNS records.
To use, follow these steps:
-
Run the following commands to apply the Terraform configuration:
terraform init terraform apply -var-file="secrets.tfvars" -auto-approve
-
To destroy the infrastructure created by Terraform, run the following command:
terraform destroy -var-file="secrets.tfvars" -auto-approve
This project is licensed under the Creative Commons Zero v1.0 Universal license, which grants full rights for editing and usage purposes to everyone.