-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebian9_lamp_advanced.py
161 lines (133 loc) · 4.67 KB
/
debian9_lamp_advanced.py
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from libs.debian9.system import *
from libs.debian9.process import *
def deploy_lamp():
"""
**********************
* Configuration R4P *
**********************
"""
# Just init var, do not change
PARAMS = {}
CONFR4P = {}
# Directory structure
PROJECT_ROOT = os.path.dirname(__file__)
CONFR4P["CONF_ROOT"] = os.path.join(PROJECT_ROOT, 'lamp-debian9')
# INI file
CONFR4P["CONF_FILE"] = "debian9_lamp_advanced.ini"
# specific dir for files configurations
CONFR4P["FILEDIR"] = "ADVANCED"
# VM env access
env.user = 'root'
env.key_filename = 'keys/changeme'
# Log output
CONFR4P["LOGFILE"] = "/tmp/logsinstallr4p"
# Exit ON error (stop program on error) - True or False (CASE!)
CONFR4P["EXITONERROR"] = True
logger = Logs(CONFR4P["LOGFILE"])
system = System(CONFR4P, PARAMS, logger)
"""
**********************
* Configuration Zone *
**********************
"""
# SYSTEM INFORMATION
# THIS VALUE ARE USED TO SET THE AUTOMATICS PARAMETERS IN THE SOFTWARES
PARAMS['HARDWARE'] = \
{
'VM': {
"CPU": 4,
"RAM": 8192
}
}
PARAMS['SOFTS'] = \
{
# Composants list:
# You have the possibility to select specifics composants
# UPGRADE, HOSTNAME, SSHHOSTKEY, DNS, USERBASHRC,
# NETWORK, MOTD ,FW ( Firewall), VIM (Vim configuration)
# SSH (sshd + sshguard), SMTP (postfix conf), LOGS, USERS
# MUST BE A LIST
'BASE':
[
"UPGRADE", "HOSTNAME",
"SSHHOSTKEY", "DNS",
"USERBASHRC", "NETWORK",
"MOTD", "FW",
"VIM", "SSH",
"SMTP", "LOGS",
"USERS"
],
# Select lamp type (or keep empty for none installation)
# LAMP_BASE (Apache, mariadb, phpmod) OR
# LAMP_ADVANCED (Apache, mariadb, php-fpm, ssl, varnish)
# MUST BE A LIST
'LAMP': ["LAMP_ADVANCED"],
# List: "VHOSTS", "VARNISH", "APACHE", "FPM", "HITCH", "SSL"
'EXCLUDES': []
}
PARAMS['CONF'] = \
{
# VHOSTS configuration
'VHOSTS':
[
{
# Main domain name
"SERVER_NAME": "sitedemo.com",
# Secondary domain name
"SERVER_NAME_ALIAS": ["www.sitedemo.com", "www.sitedemo.fr"],
# File for this domain ( zip, tar, tar.gz, tar.bz2, direct files)
"FILES": "/data/sitedemo.com/*",
},
{
"SERVER_NAME": "sitedemo1.com",
"SERVER_NAME_ALIAS": ["www.sitedemo1.com", "www.sitedemo1.fr"],
"FILES": "/data/sitedemo1.com/startbootstrap-resume-gh-pages.zip"
}
],
# DNS Servers
# MUST BE A LIST
'NETWORK_DNS': ["208.67.222.222", "8.8.8.8"],
# VM HOSTNAME
# MUST BE A STRING
'HOSTNAME': "prdweb01",
# SSH PORT
# MUST BE A STRING
'PORT_SSH_NUMBER': "22",
# GENERAL WHITELIST IP (SSH, FIREWALL, SOFT...)
# MUST BE A LIST
'WHITELITSTIPS': ["192.168.1.1", "172.16.10.5", "127.0.0.1"],
# NETWORK configuration
'CONF_INTERFACES':
[
{
"NETWORK_IP": "172.16.0.221",
"NETWORK_MASK": "255.255.255.0",
"NETWORK_GW": "172.16.0.254",
"MODE": "static",
"DEVISE": system.getinsterfacesname()
# getinsterfacesname() = Autoselection OR interface name
}
],
# USERS configuration
'USERS':
[
{
"USER": "prod",
"PASSWORD": "afinDLMLzef55fds", # CLEAR PW
"KEY": [""] # Public Key (LIST)
}
],
# Mysql users and databases configurations
'MYSQL_CONF':
[
{
"username": "produser",
"password": "qzf5gr2", # CLEAR PW
"database": "prodbase"
}
]
}
# main task, do not change
process(CONFR4P, PARAMS, logger)