/
provision.yaml
70 lines (66 loc) · 2.84 KB
/
provision.yaml
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
---
- hosts: all
vars:
php_version: "{{ lookup('env', 'PHP_VERSION') }}"
typo3_version: "{{ lookup('env', 'TYPO3_VERSION') }}"
handlers:
- name: restart apache
service: name=apache2 state=restarted
tasks:
- name: Check for required environment variables
fail: msg="Please set the PHP_VERSION and TYPO3_VERSION environment variable."
when: not php_version or not typo3_version
# Package installation
- name: Install dotdeb key
apt_key: url=http://www.dotdeb.org/dotdeb.gpg state=present
- name: Install PHP 5.5 repository
apt_repository: repo="deb http://packages.dotdeb.org wheezy-php55 all" state=present
when: php_version == "5.5"
- name: Install PHP 5.4 repository
apt_repository: repo="deb http://packages.dotdeb.org wheezy all" state=present
when: php_version == "5.4"
- name: Install backports repository
apt_repository: repo="deb http://ftp.us.debian.org/debian wheezy-backports main" state=present
- name: Install packages
apt: name={{ item }} state=present update_cache=yes
with_items:
- apache2
- php5
- php5-mysql
- php5-gd
- libapache2-mod-php5
- mysql-server
- python-mysqldb
- nodejs-legacy
- name: Install NPM
shell: curl -L https://www.npmjs.org/install.sh | sh
args:
creates: /usr/bin/npm
- name: Install node packages
npm: name={{ item }} global=yes state=present
with_items:
- jshint
- csslint
# Database setup
- copy: src=provision/database.sql dest=/tmp
- name: Create MySQL database
mysql_db: name=typo3 state=present
- name: Import MySQL database
mysql_db: name=typo3 state=import target=/tmp/database.sql
# Webserver setup
- apache2_module: state=present name={{ item }}
with_items: [php5, rewrite, env]
notify: [restart apache]
- copy: src=provision/apache_vhost dest=/etc/apache2/sites-available/default
notify: [restart apache]
- lineinfile: dest=/etc/apache2/envvars regexp="^export APACHE_RUN_USER=.*" line="export APACHE_RUN_USER=vagrant"
notify: [restart apache]
- lineinfile: dest=/etc/apache2/envvars regexp="^export APACHE_RUN_GROUP=.*" line="export APACHE_RUN_GROUP=vagrant"
notify: [restart apache]
- name: DIE FUCKING APACHE DIE DIE DIE
file: path=/var/lock/apache2 owner=vagrant group=vagrant
# TYPO3 setup
- shell: mkdir -p /vagrant/src/typo3_src-{{ typo3_version }} && cd /vagrant/src/typo3_src-{{ typo3_version }} && wget https://github.com/TYPO3/TYPO3.CMS/archive/{{ typo3_version }}.tar.gz && tar --strip-components=1 -xzf {{ typo3_version }}.tar.gz && chown vagrant . -R
args:
creates: /vagrant/src/typo3_src-{{ typo3_version }}
- file: path=/vagrant/src/typo3_src state=link src=typo3_src-{{ typo3_version }}