-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathphpapps.yml
More file actions
150 lines (127 loc) · 4.6 KB
/
phpapps.yml
File metadata and controls
150 lines (127 loc) · 4.6 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
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
---
- name: phpApps
hosts: all
become: yes
become_method: sudo
vars_files:
- vars/main.yml
vars_prompt:
- name: 'webs_selection'
prompt: "\nChoose serial number to install Web-Server? [ 1/2 ] \n\n
1: Apache\n
2: Nginx\n\n"
private: no
default: 1
- name: 'php_choose'
prompt: "\nChoose serial number to install PHP [ 1/2/../6 ]\n\n
1: PHP 5.6\n
2: PHP 7.0\n
3: PHP 7.1\n
4: PHP 7.2\n
5: PHP 7.3\n
6: PHP 7.4\n
7: PHP 8.0\n\n"
private: no
default: 4
- name: 'mysql_choose'
prompt: "\nChoose serial number to install MySQL [ 1/2/../4 ] \n\n
1: MySQL 5.5(only for CentOS7.x, AmazonLinux)\n
2: MySQL 5.6\n
3: MySQL 5.7\n
4: MySQL 8.0\n\n"
private: no
default: 3
- name: 'phpapps_selection'
prompt: "\nYou can install or not install one of below applicatons\n
\r{{phpapps_meta.keys()|list |to_nice_yaml}}\n
Input application name or press Enter directly for no application"
private: no
vars:
webs_select:
'1': 'apache'
'2': 'nginx'
infrastructure_select:
'1': 'LAMP'
'2': 'LNMP'
select_mysql_ver:
'1': "5.5"
'2': "5.6"
'3': "5.7"
'4': "8.0"
select_php_ver:
'1': "5.6"
'2': "7.0"
'3': "7.1"
'4': "7.2"
'5': "7.3"
'6': "7.4"
'7': "8.0"
# Public variables
phpapps_webs: "{{webs_select[webs_selection]}}"
w9panel_webs: "{{webs_select[webs_selection]}}"
w9panel_set_infrastructure: "{{infrastructure_select[webs_selection]}}"
pre_tasks:
- block:
- set_fact:
# apps variables
php_version: "{{phpapps_meta[phpapps_selection].phpver}}"
phpapps_name: "{{phpapps_meta[phpapps_selection].name}}"
phpapps_title: "{{phpapps_meta[phpapps_selection].title}}"
phpapps_documentroot: "{{phpapps_meta[phpapps_selection].documentroot}}"
phpapps_config_paths: "{{phpapps_meta[phpapps_selection].config_paths}}"
phpapps_commands: "{{phpapps_meta[phpapps_selection].commands}}"
w9panel_set_apps:
- "{{phpapps_meta[phpapps_selection].title}}"
mysql_version: "{{phpapps_meta[phpapps_selection].mysqlver}}"
# apps second variables
- set_fact:
mysql_databases:
- name: "{{phpapps_name}}"
mysql_users:
- name: "{{phpapps_name}}"
priv: '{{phpapps_name}}.*:ALL'
php_ioncube: "{{ (phpapps_name == 'chanzhi' or phpapps_name == 'zdoo') | ternary(True,False) }}"
docker_applications_select: "{{ (phpapps_name == 'dzzoffice') | ternary(['phpmyadmin','onlyofficedocs'],['phpmyadmin']) }}"
init_db:
mysql:
admin: root
users: ["{{phpapps_name}}"]
password: "123456"
service_before: "php-fpm.service"
config_paths: "{{phpapps_config_paths}}"
commands: "{{phpapps_commands}}"
- debug:
msg: Selected application is {{phpapps_name}}, Web app is {{w9panel_webs}}, PHP version is {{php_version}}, Mysql version is {{mysql_version}}
when: phpapps_selection != ""
- block:
- set_fact:
# lamp or lnmp variables
mysql_version: "{{select_mysql_ver[mysql_choose]}}"
php_version: "{{select_php_ver[php_choose]}}"
docker_applications_select:
- phpmyadmin
init_db:
mysql:
admin: root
password: "123456"
- debug:
msg: "{{w9panel_set_infrastructure}} will be installed, PHP version is {{php_version}}, Mysql version is {{mysql_version}}"
when: phpapps_selection == ""
- debug:
msg: 'docker applications is {{item}}'
with_items: '{{docker_applications}}'
roles:
- {role: role_common, tags: "role_common"}
- {role: role_cloud, tags: "role_cloud"}
- {role: role_apache, tags: "role_apache", when: phpapps_webs == 'apache'}
- {role: role_nginx, tags: "role_nginx", when: phpapps_webs == 'nginx'}
- {role: role_mysql, tags: "role_mysql"}
- {role: role_php, tags: "role_php"}
- {role: role_inotify_watch, tags: "role_inotify_watch"}
- {role: role_docker, tags: "role_docker"}
- {role: role_9panel, tags: "role_9panel"}
- {role: role_redis, tags: "role_redis"}
- {role: phpapps, tags: "phpapps", when: phpapps_selection != ""}
- {role: role_init, tags: "role_init"}
- {role: role_preend, tags: "role_preend"}
- {role: role_end, tags: "role_end"}