-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaybook.yml
More file actions
120 lines (108 loc) · 2.88 KB
/
playbook.yml
File metadata and controls
120 lines (108 loc) · 2.88 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
- name: osticket playbook
hosts: all
become: yes
become_user: root
vars:
apt_update_cache: yes
apt_cache_valid_time: 3600
download_path: /tmp/osticket
installation_path: /var/www/osticket
php_version: 7.2
git_repository: 'https://github.com/osTicket/osTicket'
database:
name: osticket
username: osticket
password: osticket
privileges: osticket.*: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 download directory
file:
path: "{{ download_path }}"
state: directory
owner: www-data
group: www-data
mode: 0755
- 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: "{{ download_path }}"
- name: run installation script
become: yes
become_user: www-data
command: "/usr/bin/php {{ download_path }}/manage.php deploy --setup {{ installation_path }}"
args:
creates: "{{ installation_path }}/bootstrap.php"
- name: copy config file
copy:
src: "{{ installation_path }}/include/ost-sampleconfig.php"
dest: "{{ installation_path }}/include/ost-config.php"
remote_src: yes
- 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/osticket.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