-
Notifications
You must be signed in to change notification settings - Fork 114
/
playbook.yml
163 lines (131 loc) · 4.96 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
- hosts: all
vars_files:
- vars.yml
tasks:
- name: set system timezone
template: src=system/timezone.j2 dest=/etc/timezone
become: yes
- name: reload timezone
action: command /usr/sbin/dpkg-reconfigure -f noninteractive tzdata
become: yes
- name: install python-pycurl
apt: name='python-pycurl' update_cache=yes
become: yes
- name: add ondrej/php repository
apt_repository: repo='ppa:ondrej/php'
become: yes
- include: nodejs.yml
- name: update apt cache
apt: update_cache=yes
become: yes
- name: install packages
apt: pkg={{ item }} state=present
become: yes
with_items:
- curl
- git
- php7.1
- php7.1-cli
- php7.1-curl
- php7.1-mysql
- php7.1-mcrypt
- php7.1-sqlite3
- php7.1-dom
- php7.1-mbstring
- mysql-client
- mysql-server
- python-dev
- libmysqlclient-dev
- python-mysqldb
- sqlite
- nodejs
- npm
- unzip
notify:
- restart mysql
- name: Set MySQL root password
mysql_user:
login_host: 'localhost'
login_user: 'root'
login_password: ''
name: 'root'
password: '{{ mysql_password }}'
state: present
become: yes
ignore_errors: yes
- name: create database
mysql_db: name=agendav state=present collation=utf8_general_ci encoding=utf8 login_user=root login_password="{{ mysql_password }}"
- name: check for baikal
stat: path=/var/www/baikal
register: baikal
- include: baikal.yml
when: baikal.stat.exists == false
- name: configure php
template: src=php/php.ini.j2 dest=/etc/php/7.1/apache2/php.ini owner=root mode=644 backup=yes
become: yes
notify: restart apache
- name: enable mod_rewrite
shell: /usr/sbin/a2enmod rewrite
become: yes
notify: restart apache
- name: configure apache 1/3
copy: src=apache/ports.conf dest=/etc/apache2/ports.conf owner=root mode=644 backup=yes
become: yes
notify: restart apache
- name: configure apache 2/3
copy: src=apache/agendav dest=/etc/apache2/sites-available/000-default.conf owner=root mode=644 backup=yes
become: yes
notify: restart apache
- name: configure apache 3/3
copy: src=apache/baikal dest=/etc/apache2/sites-available/baikal.conf owner=root mode=644 backup=yes
become: yes
notify: restart apache
- name: enable baikal on apache
shell: /usr/sbin/a2ensite baikal
become: yes
notify: restart apache
- name: create agendav log directory
file: path=/var/log/agendav state=directory owner=www-data group=vagrant mode=0774
become: yes
- name: create twig cache directory
file: path=/var/cache/twig state=directory owner=www-data group=vagrant mode=0774
become: yes
- name: create vendors/ directory outside of shared folder
file: path=/var/agendav-vendors state=directory owner=vagrant group=www-data mode=0775
become: yes
- name: check if composer is installed
stat: path=/usr/local/bin/composer
register: composer
- name: install composer
shell: /usr/bin/curl -sS https://getcomposer.org/installer | /usr/bin/php -- --install-dir=/usr/local/bin
when: composer.stat.exists == false
become: yes
- name: rename composer.phar
action: command /bin/mv /usr/local/bin/composer.phar /usr/local/bin/composer
when: composer.stat.exists == false
become: yes
- name: Append the COMPOSER_VENDOR_DIR variable to bashrc
lineinfile: dest=/home/vagrant/.bashrc line="export COMPOSER_VENDOR_DIR=/var/agendav-vendors"
- name: change log permissions again
file: path=/var/log/agendav recurse=true state=directory owner=www-data group=vagrant mode=0774
become: yes
- name: install node dependencies for development
npm: path=/vagrant state=present
- name: run npm build
environment:
COMPOSER_VENDOR_DIR: /var/agendav-vendors
command: npm run build chdir=/vagrant
- name: configure agendav
template: src=agendav/settings.php.j2 dest=/vagrant/web/config/settings.php backup=yes mode=0755
- name: apply latest schema updates
environment:
COMPOSER_VENDOR_DIR: /var/agendav-vendors
command: /vagrant/agendavcli migrations:migrate --configuration=/vagrant/migrations.yml --no-interaction
handlers:
- name: restart mysql
become: yes
action: service name=mysql state=restarted enabled=yes
- name: restart apache
become: yes
action: service name=apache2 state=restarted enabled=yes