-
Notifications
You must be signed in to change notification settings - Fork 0
/
dolibarr.yml
150 lines (141 loc) · 3.59 KB
/
dolibarr.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
---
- name: Update and upgrade installed packages
hosts: all
become: yes
tasks:
- apt:
upgrade: true
update_cache: true
- name: Install base packages
hosts: all
become: yes
tasks:
- apt:
pkg:
- vim
- nginx
- certbot
- python3-certbot-nginx
- curl
- git
- gpg
- gpg-agent
- name: Install MariaDB
hosts: all
become: yes
roles:
- role: geerlingguy.mysql
vars:
mysql_bind_address: 127.0.0.1
mysql_packages:
- mariadb-server
- mariadb-client
mysql_databases:
- name: "dolibarr"
collation: utf8_general_ci
encoding: utf8
mysql_users:
- name: "dolibarr"
host: localhost
password: dolibarr
priv: "dolibarr.*:ALL"
- name: "dolibarr"
host: 127.0.0.1
password: dolibarr
priv: "dolibarr.*:ALL"
- name: Install PHP
hosts: all
become: yes
roles:
- role: geerlingguy.php-versions
vars:
php_version: "7.4"
- role: geerlingguy.php
vars:
php_webserver_daemon: "nginx"
php_default_version_debian: "7.4"
php_packages_extra:
- php7.4-mysql
- php7.4-bcmath
- php7.4-intl
- php7.4-zip
- name: Setup dolibarr user
hosts: all
become: yes
tasks:
- name: Create dolibarr group
ansible.builtin.group:
name: "dolibarr"
- name: Create dolibarr user
ansible.builtin.user:
name: "dolibarr"
create_home: true
group: "dolibarr"
- name: Setup appropriate permissions over /var/www
hosts: all
become: yes
tasks:
- ansible.builtin.shell: |
chgrp www-data /var/www
chmod g+s /var/www
setfacl -m "default:group::rwx" /var/www
- name: Create Dolibarr documents folder
hosts: all
become: yes
tasks:
- file:
path: /var/lib/dolibarr
state: directory
owner: dolibarr
group: www-data
mode: 0770
recurse: true
- ansible.builtin.shell: |
chgrp www-data /var/lib/dolibarr
chmod g+s /var/lib/dolibarr
setfacl -m "default:group::rwx" /var/lib/dolibarr
- name: Clone Dolibarr source code
hosts: all
become: yes
tasks:
- raw: test -e /var/www/dolibarr
ignore_errors: yes
register: dolibarr_cloned
- ansible.builtin.shell: |
cd /var/www
git clone -b {{ git_branch | default('14.0') }} {{ git_url | default('https://github.com/Dolibarr/dolibarr.git') }} dolibarr
chmod 0770 /var/www/dolibarr
chown -R dolibarr:www-data /var/www/dolibarr
when: dolibarr_cloned.rc != 0
- name: Tweak Dolibarr forced configuration file
hosts: all
become: yes
tasks:
- name: Copy Dolibarr configuration file
ansible.builtin.template:
src: ./dolibarr.conf
dest: /var/www/dolibarr/htdocs/install/install.forced.php
owner: dolibarr
group: www-data
mode: "0640"
- name: Configure Nginx
hosts: all
become: yes
tasks:
- name: Copy Nginx configuration file
ansible.builtin.template:
src: ./nginx.conf
dest: /etc/nginx/sites-available/{{ app_url }}.conf
owner: root
group: root
mode: "0640"
- name: Enable the website
file:
src: /etc/nginx/sites-available/{{ app_url }}.conf
dest: /etc/nginx/sites-enabled/{{ app_url }}.conf
state: link
- name: Reload Nginx
service:
name: nginx.service
state: reloaded
enabled: true