-
Notifications
You must be signed in to change notification settings - Fork 18
/
environment-setup.yml
353 lines (299 loc) · 8.58 KB
/
environment-setup.yml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
---
- hosts: hosts
vars_files: ["vars/default.yml"]
become: true
gather_facts: true
pre_tasks:
- apt: update_cache=yes
- name: 'install python2'
raw: sudo apt-get -y install python-simplejson
when: ansible_distribution_version == '16.04'
tags: python
- name: Add ondrej PHP repositories
apt_repository: repo='ppa:ondrej/php' state=present
tags: lamp
- name: Add ondrej Apache repositories
apt_repository: repo='ppa:ondrej/apache2' state=present
tags: lamp
- name: Add ondrej Ansible repositories
apt_repository: repo='ppa:ansible/ansible' state=present
tags: devtools
- name: Update apt cache
apt: update_cache=yes
tags:
- aptupdate
- name: Create system User
user:
name: "{{newuser_username}}"
comment: "{{newuser_name}}"
generate_ssh_key: yes
tags:
- createuser
- name: Expire password
command: chage -d 0 {{newuser_username}}
tags:
- createuser
# - name: Install nautilus-open-terminal
# apt: name=nautilus-open-terminal state=present
# - name: Install nautilus-image-converter
# apt: name=nautilus-image-converter state=present
# - role: cmprescott.chrome
# tags:
# - devtools
# - chrome
roles:
- role: geerlingguy.apache
tags: lamp
- { role: geerlingguy.php, php_install_version: "5.6", tags: lamp }
- { role: geerlingguy.php, php_install_version: "7.0", tags: lamp }
- { role: geerlingguy.php, php_install_version: "7.1", tags: lamp }
- { role: geerlingguy.php, php_install_version: "7.2", tags: lamp }
- { role: geerlingguy.php, php_install_version: "7.3", tags: lamp }
- { role: geerlingguy.php, php_install_version: "7.4", tags: lamp }
- { role: geerlingguy.php, php_install_version: "8.0", tags: lamp }
- { role: geerlingguy.php, php_install_version: "8.1", tags: lamp }
- { role: geerlingguy.php, php_install_version: "8.2", tags: lamp }
- { role: geerlingguy.php, php_install_version: "8.3", tags: lamp }
- { role: geerlingguy.apache-php-fpm, tags: lamp }
- role: calebwoods.bash_command
command: 'sudo service apache2 stop'
tags: lamp
- { role: geerlingguy.nginx, tags: lamp }
- role: geerlingguy.mysql
ignore_errors: yes
tags:
- devtools
- mysql
- lamp
- role: geerlingguy.composer
tags:
- devtools
- composer
- role: geerlingguy.java
ignore_errors: yes
when: "ansible_os_family == 'Debian'"
java_packages:
- openjdk-8-jdk
tags:
- devtools
- java
tasks:
- name: Install Geany and plugins
apt: name={{item}} state=present
with_items:
- geany
- geany-plugins
- geany-plugins-common
- geany-plugin-addons
- geany-plugin-prettyprinter
- openssh-server
tags: devtools
- name: Install GIT
apt: name=git-core state=present
tags: devtools
- name: Register Joomla Standards path
shell: echo `pear config-get php_dir`/PHP/CodeSniffer/Standards/Joomla
register: phpcs_joomla_path
tags:
- phpcs
- devtools
- name: stat Joomla Standards path
stat: path="{{phpcs_joomla_path.stdout}}/ruleset.xml"
register: phpcs_joomla_path_stat
tags:
- phpcs
- devtools
- name: Create Joomla Standards path
file:
path: "{{phpcs_joomla_path}}"
state: directory
mode: 0755
tags:
- phpcs
- devtools
- name: Install PHPCS 1.5.6 via PEAR
shell: "pear install -f PHP_CodeSniffer-1.5.6"
tags:
- devtools
- phpcs
- name: Install Joomla Standard
shell: "git clone -b 1.x https://github.com/joomla/coding-standards.git `pear config-get php_dir`/PHP/CodeSniffer/Standards/Joomla"
when: phpcs_joomla_path_stat.stat.exists == False
tags:
- devtools
- phpcs
- name: Create NGINX Log format
template:
src: "templates/nginx-logformat.j2"
dest: "/etc/nginx/conf.d/ttpl_nginx_log.conf"
tags: lamp
- name: Create logrotate config
template:
src: "templates/logrotate.j2"
dest: "/etc/logrotate.d/ttpl"
tags: lamp
- name: Install codeception
get_url:
url: http://codeception.com/codecept.phar
dest: /usr/bin/codecept
mode: 0755
timeout: 1000
tags: devtools
- name: Install restricted extras
apt: name=ubuntu-restricted-extras state=present
- name: Install npm
apt: name=npm
tags: devtools
- name: Install FileZilla
apt: name=filezilla
tags: devtools
- name: Install VIM
apt: name=vim
- name: Install Meld
apt: name=meld state=present
tags: devtools
- name: Install ansible
apt: name=ansible state=present
tags:
- devtools
- ansible
- name: Install VLC
apt: name=vlc state=present
tags: vlc
- name: Install Sublime
apt: name=sublime-text state=present
tags: devtools
- name: Remove default NGINX vhosts file
file:
name: "/etc/nginx/sites-enabled/default"
state: absent
tags: lamp
- name: Remove default Apache vhosts file
file:
name: "/etc/apache2/sites-enabled/vhosts.conf"
state: absent
tags: lamp
- name: Remove default Apache 000-default file
file:
name: "/etc/apache2/sites-enabled/000-default.conf"
state: absent
tags: lamp
- name: Remove default FPM Pool
file:
name: "/etc/php/{{item}}/fpm/pool.d/www.conf"
state: absent
tags: lamp
with_items:
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- name: chmod hosts file
file:
path: "/etc/hosts"
mode: "og+w"
tags: devtools
- name: Allow user to restart Apache
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /usr/sbin/service apache2 *"
validate: 'visudo -cf %s'
tags:
- devtools
- name: Allow user to restart NGINX
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /usr/sbin/service nginx *"
validate: 'visudo -cf %s'
tags:
- devtools
- name: Allow user to restart FPM (PHP 5.6)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php5.6-fpm *"
validate: 'visudo -cf %s'
tags:
- devtools
- name: Allow user to restart FPM (PHP 7.0)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php7.0-fpm *"
validate: 'visudo -cf %s'
tags:
- devtools
- name: Allow user to restart FPM (PHP 7.1)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php7.1-fpm *"
validate: 'visudo -cf %s'
tags:
- devtools
- name: Allow user to restart FPM (PHP 7.2)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php7.2-fpm *"
validate: 'visudo -cf %s'
tags:
- devtools
- name: Allow user to restart FPM (PHP 7.3)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php7.3-fpm *"
validate: 'visudo -cf %s'
tags:
- devtools
- name: Allow user to restart FPM (PHP 7.4)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php7.4-fpm *"
validate: 'visudo -cf %s'
tags: devtools
- name: Allow user to restart FPM (PHP 8.0)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php8.0-fpm *"
validate: 'visudo -cf %s'
tags: devtools
- name: Allow user to restart FPM (PHP 8.1)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php8.1-fpm *"
validate: 'visudo -cf %s'
tags: devtools
- name: Allow user to restart FPM (PHP 8.2)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php8.2-fpm *"
validate: 'visudo -cf %s'
tags: devtools
- name: Allow user to restart FPM (PHP 8.3)
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /etc/init.d/php8.3-fpm *"
validate: 'visudo -cf %s'
tags: devtools
- name: Allow user to restart MySQL
lineinfile:
dest: /etc/sudoers
state: present
line: "{{server_runs_as}} ALL = NOPASSWD: /usr/sbin/service mysql *"
validate: 'visudo -cf %s'
tags: devtools