Skip to content

Project to demonstrate using Ansible to setup and configure servers to run simple web application

License

Notifications You must be signed in to change notification settings

skipluck/bestsongs-static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Best Songs (Static)

Project to demonstrate using Ansible to:

  • Setup and configure Debian based Web Server, Application Server and DB server
  • Deploy sample web application queries the database and displays a random song from list of 100 songs.
  • Leveraged Ansible Tutorial by @nbkr
  • Best Songs (Dynamic) that uses Dynamic inventory for AWS
Web Server App Server DB server
Install common software packages Install common software packages Install common software packages
Configure SSH banner Configure SSH banner Configure SSH banner
Install Apache Install gunicorn (Python HTTP server) Install MySQL
Configure Apache as reverse proxy Configure gunicorn to run as service using supervisor Create database
Restart Apache Deploy application code Create table and import sample data
Restart services

Prerequisites

Running this project

Open terminal window and run the following commands

Install Ansible on Ubuntu Linux

sudo apt-get update
sudo apt-get install git python3 python3-pip python3-venv libssl-dev
pip3 install --upgrade pip

Cloning this project from github

git clone https://github.com/skipluck/bestsongs-static

Creating Ansible Project Virtual Environment

cd bestsongs-static
python3 -m venv BestSongs
source BestSongs/bin/activate

Installing Ansible and other packages

pip3 install ansible

Edit hosts files

Open hosts file in your favorite editor and add respective hostsnames for web, app and db servers

Sample hosts files

[webservers]
ec2-54-210-56-37.compute-1.amazonaws.com ansible_user=ubuntu
[appservers]
ec2-34-229-178-128.compute-1.amazonaws.com ansible_user=ubuntu
[dbservers]
ec2-35-172-201-189.compute-1.amazonaws.com ansible_user=ubuntu

Executing Ansible playbook

ansible-playbook -i hosts playbook.yml

Exiting Virtual Environment

deactivate

About

Project to demonstrate using Ansible to setup and configure servers to run simple web application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published