Added Timetrex role

This commit is contained in:
Kris Lamoureux 2020-01-20 17:56:31 -05:00
parent 73cc25c434
commit 2c3df61caf
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
4 changed files with 174 additions and 2 deletions

View File

@ -0,0 +1,111 @@
- name: Install PostgreSQL
apt:
name: postgresql
state: present
become: yes
- name: Install unzip
apt:
name: unzip
state: present
become: yes
- name: Install PHP Modules
apt:
name: [
# Required
'php-bcmath', 'php-mbstring', 'php-soap',
'php-gd', 'php-xml', 'php-curl', 'php-zip',
# Database Connectors
'php-pgsql',
]
state: present
notify: Reload Apache2
- name: Download and extract Timetrex
unarchive:
src: "https://www.timetrex.com/direct_download/\
TimeTrex_Community_Edition-manual-installer.zip"
dest: /var/www
creates: "{{ tx_dir }}"
remote_src: yes
become: yes
- name: Create Timetrex directory
file:
path: "{{ tx_dir }}"
state: directory
- name: Move Timetrex directory
shell: mv /var/www/TimeTrex_Community_Edition_* {{ tx_dir }}/public_html
args:
creates: "{{ tx_dir }}/public_html"
- name: Apply Timetrex directory permissions
file:
path: "{{ tx_dir }}/public_html"
owner: www-data
group: www-data
state: directory
recurse: yes
- name: Create Timetrex directory
file:
path: /var/timetrex
group: www-data
mode: '0775'
state: directory
recurse: yes
- name: Create another Timetrex directory
file:
path: /var/timetrex/storage
group: www-data
mode: '0775'
state: directory
recurse: yes
- name: Create Timetrex log directory
file:
path: /var/log/timetrex
group: www-data
mode: '0775'
state: directory
recurse: yes
- name: Apply Timetrex Configuration
template:
src: timetrex.ini.php.j2
dest: "{{ tx_dir }}/public_html/timetrex.ini.php"
- name: Create Timetrex log directory
file:
path: "/var/log/apache2/{{ tx_domain }}"
state: directory
- name: Create Timetrex database
postgresql_db:
name: "{{ tx_db_name }}"
become: yes
become_user: postgres
- name: Create Timetrex database user
postgresql_user:
db: "{{ tx_db_name }}"
name: "{{ tx_db_user }}"
password: "{{ tx_db_pass }}"
become: yes
become_user: postgres
- name: Apply Apache Configuration
template:
src: timetrex.conf.j2
dest: /etc/apache2/sites-available/{{ tx_domain }}.conf
notify: Reload Apache2
- name: Enable Apache Website
shell: a2ensite {{ tx_domain }}
args:
creates: /etc/apache2/sites-enabled/{{ tx_domain }}.conf
notify: Reload Apache2

View File

@ -0,0 +1,17 @@
<VirtualHost *:80>
ServerName {{ tx_domain }}
ServerAdmin {{ tx_admin_email }}
DocumentRoot {{ tx_dir }}/public_html
ErrorLog /var/log/apache2/{{ tx_domain }}/error.log
CustomLog /var/log/apache2/{{ tx_domain }}/access.log combined
</VirtualHost>
<Directory {{ tx_dir }}/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1,44 @@
;<?php die('Unauthorized Access...'); //SECURITY MECHANISM, DO NOT REMOVE//?>
[path]
base_url = /interface
log = /var/log/timetrex
storage = /var/timetrex/storage
php_cli = /usr/bin/php
[database]
type = postgres
host = {{ tx_db_host }}
database_name = {{ tx_db_name }}
user = {{ tx_db_user }}
password = {{ tx_db_pass }}
[cache]
enable = TRUE
dir = /tmp/timetrex
[debug]
production = TRUE
enable = FALSE
enable_display = FALSE
buffer_output = TRUE
enable_log = FALSE
verbosity = 10
[other]
force_ssl = FALSE
installer_enabled = TRUE
primary_company_id = 0
hostname = localhost
; WARNING: DO NOT CHANGE THIS AFTER YOU HAVE INSTALLED TIMETREX.
; If you do it will cause all your passwords to become invalid,
; and you may lose access to some encrypted data.
salt = "{{ tx_db_salt }}"

View File

@ -21,4 +21,4 @@
- webserver
- wordpress
- nextcloud
- timetrex