diff --git a/roles/timetrex/tasks/main.yml b/roles/timetrex/tasks/main.yml
new file mode 100644
index 0000000..18198cc
--- /dev/null
+++ b/roles/timetrex/tasks/main.yml
@@ -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
diff --git a/roles/timetrex/timetrex.conf.j2 b/roles/timetrex/timetrex.conf.j2
new file mode 100644
index 0000000..e1134bb
--- /dev/null
+++ b/roles/timetrex/timetrex.conf.j2
@@ -0,0 +1,17 @@
+
+ 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
+
+
+
+ Options Indexes FollowSymLinks
+ AllowOverride All
+ Require all granted
+
+
+# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
diff --git a/roles/timetrex/timetrex.ini.php.j2 b/roles/timetrex/timetrex.ini.php.j2
new file mode 100644
index 0000000..c81a850
--- /dev/null
+++ b/roles/timetrex/timetrex.ini.php.j2
@@ -0,0 +1,44 @@
+;
+
+[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 }}"
diff --git a/webserver.yml b/webserver.yml
index 6d0f452..a371951 100644
--- a/webserver.yml
+++ b/webserver.yml
@@ -18,7 +18,7 @@
become: yes
roles:
- ansible
- - webserver
+ - webserver
- wordpress
- nextcloud
-
+ - timetrex