This deploy the lufi application on EC2 instance using the Terraform(Infrastructure) and Ansible(Configuration)
git clone https://github.com/arunodhayamsam/lufi-aws-deploy.gitPut the below command after cloning the repository for update the git submodule to get the content from submodule repositoy
cd lufi-aws-deploy
git submodule update --init
Create the site.yaml ansible playbook for access the ansible-roles to application runing.
#site.yaml
- hosts: all
become: true
roles:
- <path_to_ansible-role-lufi>
Enter into the terraform-aws-deploy directory
cd terraform-aws-lufiEdit the main.tf template to add the path of ansible palybook.yml
provisioner "local-exec" {
command = <<EOT
sleep 30 && \
>hosts && \
echo "[Lufi]" | tee -a hosts && \
echo "${aws_instance.ec2_instance.public_ip} ansible_user=${var.user} ansible_ssh_private_key_file=${var.private_key}" | tee -a hosts && \
export ANSIBLE_HOST_KEY_CHECKING=False && \
ansible-playbook -u ${var.user} --private-key ${var.private_key} -i hosts <path_to_playbook's_site.yml>
EOT
}terraform init
terraform plan
terraform applyDon’t hesitate to create a pull request