-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw1.sh
33 lines (33 loc) · 1.49 KB
/
hw1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Bash script for server provisioning and configuration
# The script first installs the required dependencies and then performs necessary tasks for
# spinning up VMs and installing nginx with the help of ansible playbook.
echo "==================================================="
echo "Please view requirements.txt first before we continue"
cat requirements.txt
sleep 4
echo "==================================================="
echo "Installing dependencies from package.json"
npm install
echo "Installed needle, aws-sdk and dateFormat packages"
echo "==================================================="
echo "==================================================="
sleep 1
echo "Creating an instance on AWS and writing to inventory file"
node aws.js
echo "==================================================="
echo "==================================================="
sleep 1
echo "Creating an instance on DigitalOcean and appending to inventory file"
node do.js
echo "==================================================="
echo "==================================================="
sleep 5
echo "Lets run the ping test to make sure we can actually talk to the nodes"
ansible all -m ping -i inventory -vvvv
echo "==================================================="
echo "==================================================="
echo "Playing the ansible playbook."
ansible-playbook -i inventory --sudo ansible-playbook.yml
echo "Playbook executed successfully."
echo "==================================================="