-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaybook.yml
147 lines (117 loc) · 3.88 KB
/
playbook.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
---
- hosts:
- default
user: vagrant
sudo: true
tasks:
# Get up-to-date
- name: apt-get update + upgrade
apt: update_cache=yes upgrade=yes
# Prerequisites
- name: install libs
apt: name={{ item }} state=present
with_items:
- build-essential
- git
- curl
- python-software-properties
- python-pip
- python-dev # For fabric's deps
- nginx
- supervisor
notify: start nginx
# Some apps require node/npm
- name: ppa for nodejs
apt_repository: repo='ppa:chris-lea/node.js'
- name: install node.js
apt: name=nodejs state=present update_cache=yes
# PHP 5.5 + extensions
- name: ppa for php 5.5
apt_repository: repo='ppa:ondrej/php5'
- name: install php
apt: name={{ item }} state=present update_cache=yes
with_items:
- php5-apcu
- php5-cli
- php5-curl
- php5-dev
- php5-fpm
- php5-intl
- php5-mcrypt
- php5-memcached
- php5-mysql
- php-pear
- php5-pgsql
- php5-xdebug
notify: start php-fpm
- name: install composer
shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin
- name: configure composer
shell: mv /usr/local/bin/composer.phar /usr/local/bin/composer && chmod +x /usr/local/bin/composer
# Memcached
- name: install memcached
apt: name=memcached state=present
# Redis
- name: install redis server
apt: name=redis-server state=present
# MySQL
- name: install mysql server
apt: name=mysql-server state=present
# PostgreSQL
- name: install postgres server
apt: name=postgresql
# Beanstalkd
- name: install beanstalkd
apt: name=beanstalkd
# Beanstalkd Console
- name: clone beanstalkd-console
git: repo=https://github.com/ptrofimov/beanstalk_console.git dest=/srv/beanstalkd
- name: configure beanstalkd php-fpm pool
template: src=files/beanstalkd.php-fpm dest=/etc/php5/fpm/pool.d/beanstalkd.conf
notify: restart php-fpm
- name: configure beanstalkd nginx host
template: src=files/beanstalkd.nginx dest=/etc/nginx/sites-available/beanstalkd
# GruntJS
- name: install gruntjs
npm: name=grunt-cli state=present global=yes
# Redis Commander
- name: install redis commander
npm: name=redis-commander state=present global=yes
- name: configure redis commander supervisor
template: src=files/redis.supervisor dest=/etc/supervisor/conf.d/redis.conf
notify: reload redis-commander
- name: configure redis commander nginx host
template: src=files/redis.nginx dest=/etc/nginx/sites-available/redis
# Laravel app
- name: configure laravel php-fpm pool
template: src=files/laravel.php-fpm dest=/etc/php5/fpm/pool.d/laravel.conf
notify: restart php-fpm
- name: configure laravel nginx host
template: src=files/laravel.nginx dest=/etc/nginx/sites-available/laravel
# Fabric
- name: install fabric
pip: name=fabric state=present
# PECLs
#- shell: sudo pecl install {{ item }}
# with_items:
# - pecl_http
- name: disable default nginx host
file: dest=/etc/nginx/sites-enabled/default state=absent
- name: enable nginx hosts
file: src=/etc/nginx/sites-available/{{ item }} dest=/etc/nginx/sites-enabled/{{ item }} state=link
with_items:
- beanstalkd
- redis
- laravel
notify: restart nginx
handlers:
- name: start nginx
service: name=nginx state=started
- name: start php-fpm
service: name=php5-fpm state=started
- name: restart nginx
service: name=nginx state=restarted
- name: restart php-fpm
service: name=php5-fpm state=restarted
- name: reload redis-commander
supervisorctl: name=redis state=started