Ansible Playbooks for setting up an EC2 instance, Installing Docker & Running a Nginx enabled container that serves up static pages behind a HTTP Auth.
- Ansible ~> 2.0
- Python ~> 2.7
- Boto ~> 2.34
- Playbook assumes that the Instance will be launched in the us-east-1 region. (TODO: Make it configurable)
- Import your ssh key into EC2 with the name "Devops_Test" (Mandatory, other names will not work.)
- Install required packages
sudo apt-get install software-properties-common sudo apt-add-repository ppa:ansible/ansible sudo apt-get update sudo apt-get install ansible python-pip sudo pip install boto
-
Clone the Repo
git clone https://github.com/vinay-nadig-0042/DevOps-Test.git
-
Export AWS Keys - Make sure the keys corresponding to the IAM user has sufficient privilages to launch & administer EC2 Intances.
export AWS_ACCESS_KEY_ID='AKIXXX' export AWS_SECRET_ACCESS_KEY='AKIXXX'
-
Run the Playbook
ansible-playbook -i ./inventory master.yaml -vvvv
-
Access the Default Page - http://<public-ip-of-launched-instance>/ - IP has to be accessed from the EC2 Console. TODO: Output Public IP at the end of the playbook execution.
- https://github.com/electroniceagle/ansible-dc-ec2-tutorial
- http://docs.ansible.com/ansible/intro_dynamic_inventory.html
- http://docs.ansible.com/ansible/developing_modules.html
- Docker Installation & Configuration - https://github.com/angstwad/docker.ubuntu
- Display EC2 Public IP at the end of the playbook execution
- Make region configurable(Currently only us-east-1 is supported)
- EC2 IP Address extracted through the EC2 Dynamic Inventory Script.
- The check on whether an instance exists or not is checked through a custom module located at library/check_named_instance.py