-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaybook.yml
More file actions
105 lines (95 loc) · 2.47 KB
/
playbook.yml
File metadata and controls
105 lines (95 loc) · 2.47 KB
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
- name: invoice ninja playbook
hosts: all
become: yes
become_user: root
vars:
apt_update_cache: yes
apt_cache_valid_time: 3600
installation_path: /var/www/invoiceninja
php_version: 7.2
git_repository: 'https://github.com/invoiceninja/invoiceninja.git'
database:
name: ninja
username: ninja
password: ninja
privileges: ninja.*:ALL
install_packages:
- python3-mysqldb
- composer
- curl
- git
- nginx
- mariadb-server
- mariadb-client
- php-fpm
- php-mysql
- php-gmp
- php-curl
- php-intl
- php-mbstring
- php-xmlrpc
- php-gd
- php-xml
- php-cli
- php-zip
tasks:
# Setup
- name: install required packages
apt:
name: "{{ install_packages }}"
update_cache: "{{ apt_update_cache }}"
cache_valid_time: "{{ apt_cache_valid_time }}"
# Database
- name: create database
mysql_db:
name: "{{ database.name }}"
- name: create database user
mysql_user:
name: "{{ database.username }}"
password: "{{ database.password }}"
priv: "{{ database.privileges }}"
# Web
- name: copy php ini overrides
copy:
src: files/php/99-local.ini
dest: "/etc/php/{{ php_version }}/fpm/conf.d/99-local.ini"
mode: 0644
notify: reload nginx
- name: create installation directory
file:
path: "{{ installation_path }}"
state: directory
owner: www-data
group: www-data
mode: 0755
- name: clone git repository
git:
repo: "{{ git_repository }}"
dest: "{{ installation_path }}"
- name: run composer installation
become: yes
become_user: www-data
command: "/usr/bin/composer install --working-dir={{ installation_path }} --quiet"
args:
creates: "{{ installation_path }}/vendor"
- name: set permissions on installation
file:
path: "{{ installation_path }}/"
state: directory
recurse: yes
owner: www-data
group: www-data
mode: u=rwX,g=rX,o=rX
- name: copy virtual host configuration
template:
src: templates/nginx/invoiceninja.j2.conf
dest: /etc/nginx/sites-available/default
owner: www-data
group: www-data
mode: 0644
notify: reload nginx
handlers:
- name: reload nginx
service:
name: nginx
state: reloaded