forked from imnowdevops/ddc-material
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfabfile.py
More file actions
58 lines (45 loc) · 1.82 KB
/
Copy pathfabfile.py
File metadata and controls
58 lines (45 loc) · 1.82 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from fabric.api import *
env.user = 'devops'
def greeting(msg):
print "Good %s" % msg
def system_info():
print "Disk Space"
local("df -h")
print "RAM size"
local("free -m")
print "System uptime."
local("uptime")
def remote_exec():
print "Get System Info"
run("hostname")
run("uptime")
run("df -h")
run("free -m")
sudo("yum install mariadb-server -y")
sudo("systemctl start mariadb")
sudo("systemctl enable mariadb")
def web_setup(WEBURL, DIRNAME):
print "###################################################################################"
local("apt install zip unzip -y")
print "###################################################################################"
print "Installing dependencies"
print "###################################################################################"
sudo("yum install httpd wget unzip -y")
print "###################################################################################"
print "Start & enable service."
print "###################################################################################"
sudo("systemctl start httpd")
sudo("systemctl enable httpd")
print "###################################################################################"
print "Downloading and pushing website to webservers."
print "###################################################################################"
local(("wget -O website.zip %s") % WEBURL)
local("unzip -o website.zip")
print "###################################################################################"
with lcd(DIRNAME):
local("zip -r tooplate.zip * ")
put("tooplate.zip", "/var/www/html/", use_sudo=True)
with cd("/var/www/html/"):
sudo("unzip -o tooplate.zip")
sudo("systemctl restart httpd")
print "Website setup is done."