-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.yml
163 lines (128 loc) · 4.5 KB
/
dev.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
---
- hosts: dev
vars_prompt:
- name: "mysql_password"
prompt: "Mysql pass"
tasks:
- name: Add MariaDB repository
apt_repository: repo='deb http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.0/ubuntu trusty main' state=present
- name: Add repository key to the system
apt_key: keyserver=keyserver.ubuntu.com id=0xcbcb082a1bb943db
- name: Install MariaDB Server
apt: name={{ item }} state=latest update_cache=yes
with_items:
- mariadb-server
- python-mysqldb
- name: Install Redis Server
apt: name={{ item }} state=latest update_cache=yes
with_items:
- redis-server
- python-redis
- name: Install nginx
apt: name=nginx state=latest update_cache=yes
- name: Add PHP 7 ppa
apt_repository: repo='ppa:ondrej/php' state=present
- name: Install PHP 7 & extensions
apt: name={{ item }} state=latest update_cache=yes
with_items:
- php7.0
- php7.0-mysql
- php7.0-mcrypt
- php7.0-curl
- php7.0-mbstring
- php7.0-dom
- php7.0-zip
- php7.0-gd
- name: Install Mono
apt: name=mono-complete state=latest update_cache=yes
- name: Install Git
apt: name=git state=latest update_cache=yes
- name: Install composer
shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
args:
creates: /usr/local/bin/composer
- name: Install nodejs
apt: name=nodejs state=latest update_cache=yes
- name: Install npm
apt: name=npm state=latest update_cache=yes
- name: Symminking node
file: src=/usr/bin/nodejs dest=/usr/bin/node state=link
- name: Updating npm
npm: name=npm global=true
- name: Install bower
npm: name=bower global=true
- name: Install gulp
npm: name=gulp global=true
- name: Install Supervisor
apt: name=supervisor state=latest update_cache=yes
- name: Create MySQL User
mysql_user: name=pn priv=parkitectnexus.*:ALL password={{ mysql_password }} state=present
- name: Create MySQL DB
mysql_db: name=parkitectnexus state=present
- name: Update MySQL passes
mysql_user:
name: pn
host: "{{ item }}"
password: "{{ mysql_password }}"
login_user: on
login_password: "{{ mysql_password }}"
check_implicit_admin: yes
priv: "*.*:ALL,GRANT"
with_items:
- "{{ ansible_hostname }}"
- 127.0.0.1
- ::1
- localhost
notify:
restart mariadb
- name: Config php fpm user
ini_file: dest=/etc/php/7.0/fpm/pool.d/www.conf section=www option=user value=pn mode=0660 backup=yes
notify: restart fpm
- name: Config php fpm group
ini_file: dest=/etc/php/7.0/fpm/pool.d/www.conf section=www option=group value=pn mode=0660 backup=yes
notify: restart fpm
- name: Config php upload max filesize
ini_file: dest=/etc/php/7.0/fpm/php.ini section=PHP option=upload_max_filesize value=50M mode=0660 backup=yes
notify: restart fpm
- name: Config php post max size
ini_file: dest=/etc/php/7.0/fpm/php.ini section=PHP option=post_max_size value=50M mode=0660 backup=yes
notify: restart fpm
- name: Config php memory limit
ini_file: dest=/etc/php/7.0/fpm/php.ini section=PHP option=memory_limit value=256M mode=0660 backup=yes
notify: restart fpm
- name: Configure nginx pn host
template: src=conf/dev/dev.parkitectnexus.com.conf dest=/etc/nginx/sites-available/default
notify:
- restart fpm
- restart nginx
- name: Configure nginx fastcgi
template: src=conf/dev/fastcgi_params.conf dest=/etc/nginx/fastcgi_params
notify:
- restart fpm
- restart nginx
- name: Copy public key
authorized_key: user=pn key="{{ lookup('file', 'conf/dev/key.pub') }}"
- name: Authorize envoyer to restart fpm
command: "echo 'pn ALL=NOPASSWD: /usr/sbin/service php7.0-fpm reload' | sudo tee -a /etc/sudoers.d/php-fpm > /dev/null"
- name: Setup Laravel Scheduler
cron: >
job="php /home/pn/parkitectnexus.com/current/artisan schedule:run 1>> /dev/null 2>&1"
state=present
user=pn
name="php artisan schedule:run"
- name: Setup queues
template: src=worker/queue dest=/etc/supervisor/conf.d/worker-{{ item }}.conf
with_items:
- 1
- 2
- 3
- 4
handlers:
- name: restart redis
service: name=redis-server state=restarted
- name: restart mariadb
service: name=mysql state=restarted
- name: restart fpm
service: name=php7.0-fpm state=restarted
- name: restart nginx
service: name=nginx state=restarted