jsgilberto / simple-deploy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple deployment on EC2 with Ansible

In this project, a flask web app is configured in an EC2 instance using Ansible.

Running Ansible

Locally

Change hosts to localhost in ansible/main-remote.yml

And run the following command:

$ ansible-playbook ansible/main-remote.yml --verbose --ask-become-pass

Remote hosts:

First, we need to define an inventory file with all the IP addresses of the instances where we want Ansible to connect, and for that, I created a shell script in the ansible directory within this project.

To create the inventory file run the following in your terminal:

$ ansible/create_inventory.sh

Run the following command:

$ ansible-playbook ansible/main-remote.yml -i $INVENTORY_FILE --private-key $EC2_KEY_PATH

Infrastructure

Cloudformation

The deployment of this project is done through AWS Cloudformation. For the deployment I decided to use an EC2 instance with ubuntu 18.

aws cloudformation deploy \
    --template-file infrastructure/server.yml \
    --stack-name simple-deploy \
    --region us-east-1 \
    --profile personal

About


Languages

Language:Shell 72.0%Language:Python 14.3%Language:Makefile 13.8%