Create an ansible playbook that is able to:
-
Provision: Create a new virtual machine from a virtual machine provider (in this case, Amazon EC2)
-
Setup: Install the following items:
- Install node.js
- Install forever
- Pull/clone this simple server (from github) into a destination
- Install npm packages
-
Tasks:
- Run app using node and forever
forever start node main.js
- Security: A task that ensures
bash
,openssl
,openssh-client
, andopenssh-server
are running latest version. - Cleanup: Removing content in
/tmp/*
- Run app using node and forever
-
Install vagrant.
-
Install VirtualBox.
-
Open Terminal on Mac OS X or command prompt on Windows and initialize a virtual machine.
vagrant init ubuntu/trusty64
This will create a Ubuntu 14.04 virtual machine.
-
Boot the virtual machine using:
vagrant up
-
SSH into the virtual maching using:
vagrant ssh
-
Then download and run this shell script by using
. ansible.sh
.-
The script will automatically install all dependencies required for ansible and also install ansible.
-
Then it clones this repository.
-
After cloning, it runs the Ansible playbook to create a new AWS EC2 instance and then perform the necessary configuration management tasks.
-
Finally the simple web server app is started automatically.
-