Newer
Older
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
---
# file: roles/matomo/tasks/install.yml
- block:
- set_fact:
webRoot='/var/www/matomo/{{ matomo.id }}'
apacheUser='www-data'
apacheLogDir='/var/log/apache2'
when: matomo.jail is not defined
- set_fact:
webRoot='{{ jailroot }}/{{ matomo.id }}/var/www/matomo'
apacheUser='{{ matomo.id }}'
apacheLogDir='{{ jailroot }}/{{ matomo.id }}/var/log/apache2'
when: matomo.jail is defined
tags: 'always'
- name: "Configure Apache"
include_tasks: apache.yml
tags: 'ApacheConfig'
- name: "Remove existing components"
file:
path: '{{ item }}'
state: 'absent'
with_items:
- '{{ webRoot }}'
when: matomo_force_reset
tags: 'always'
- name: "Ensure Root Directories"
file:
path='{{ item }}'
state='directory'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='775'
with_items:
- '{{ webRoot }}'
tags: 'always'
- name: "File Modes and Ownership"
file:
path='{{ webRoot }}'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='g+w'
recurse=yes
follow=no
tags: 'deploy'
- name: "Clone Git Repository"
git:
accept_hostkey: yes
repo: 'git@github.com:matomo-org/matomo.git'
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
dest: '{{ webRoot }}'
track_submodules: yes
force: yes
version: '{{ matomo_version }}'
become: false
environment:
GIT_LFS_SKIP_SMUDGE: '1'
tags: 'deploy'
- name: "Configuration file"
template:
src='config.ini.php'
dest='{{ webRoot }}/config/config.ini.php'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='664'
tags: 'deploy'
- name: "Composer"
composer:
command='update'
working_dir='{{ webRoot }}'
no_dev=yes
optimize_autoloader=yes
prefer_dist=yes
ignore_errors: true
tags: 'deploy'
- name: "Ensure Working Directories"
file:
path='{{ item }}'
state='directory'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='775'
with_items:
- '{{ webRoot }}/tmp'
tags: 'always'
- name: "File Modes and Ownership"
file:
path='{{ webRoot }}'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='a-w'
recurse=yes
follow=no
tags: 'deploy'
- name: "File Modes for .git Directory"
file:
path='{{ webRoot }}/.git'
mode='og+w'
recurse=yes
follow=no
tags: 'deploy'
- name: "File Modes for tmp"
file:
path='{{ webRoot }}/tmp'
mode='ug+w'
recurse=yes
follow=no
tags: 'deploy'
- name: "Ensure Database"
mysql_db:
name='matomo_{{ matomo.id }}'
login_user='root'
login_password='{{ mysql_root_password|default("root") }}'
login_host='127.0.0.1'
login_port='{{ matomo.db_port|default('3306') }}'
state='present'
- name: "Run Upgrade"
command: '{{ webRoot }}/console core:update --yes --no-interaction'
become_user: '{{ apacheUser }}'
ignore_errors: true
tags: 'deploy'