diff --git a/defaults/main.yaml b/defaults/main.yaml index ed97d53..40e5ebc 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -1 +1,2 @@ --- +kanboard_server_name: "{{ inventory_hostname }}" diff --git a/tasks/access.yaml b/tasks/access.yaml new file mode 100644 index 0000000..ce1a1fd --- /dev/null +++ b/tasks/access.yaml @@ -0,0 +1,7 @@ +--- + +- name: kanboard data directory writable + file: + path: /var/www/kanboard/data + owner: www-data + group: www-data diff --git a/tasks/certificate.yaml b/tasks/certificate.yaml new file mode 100644 index 0000000..616d105 --- /dev/null +++ b/tasks/certificate.yaml @@ -0,0 +1,6 @@ +--- + +- include_role: + name: certificate + vars: + certificate_name: kanboard diff --git a/tasks/main.yaml b/tasks/main.yaml index ed97d53..8a819e5 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -1 +1,7 @@ --- + +- import_tasks: setup.yaml +- import_tasks: source.yaml +- import_tasks: access.yaml +- import_tasks: certificate.yaml +- import_tasks: vhost.yaml diff --git a/tasks/setup.yaml b/tasks/setup.yaml new file mode 100644 index 0000000..a20eb11 --- /dev/null +++ b/tasks/setup.yaml @@ -0,0 +1,26 @@ +--- + +- import_role: + name: apache + +- import_role: + name: php + vars: + php_configure_opcache: true + +- name: debian packages + apt: + pkg: + - git + - php-pdo-sqlite + - php-pdo-mysql + - php-pdo-pgsql + - php-gd + - php-mbstring + - php-json + - php-ctype + - php-xml + - php-dom + - php-zip + - php-ldap + - php-curl diff --git a/tasks/source.yaml b/tasks/source.yaml new file mode 100644 index 0000000..6fa5b48 --- /dev/null +++ b/tasks/source.yaml @@ -0,0 +1,20 @@ +--- + +- name: get kanboard releases + uri: + url: https://api.github.com/repos/kanboard/kanboard/releases + return_content: true + register: _kanboard_releases + + +- name: get latest kanboard release + uri: + url: https://api.github.com/repos/kanboard/kanboard/releases/latest + return_content: true + register: _kanboard_latest_release + +- name: kanban repo + git: + repo: https://github.com/kanboard/kanboard.git + version: "{{ _kanboard_latest_release.json.tag_name }}" + dest: /var/www/kanboard diff --git a/tasks/vhost.yaml b/tasks/vhost.yaml new file mode 100644 index 0000000..6d1d3dd --- /dev/null +++ b/tasks/vhost.yaml @@ -0,0 +1,14 @@ +--- + +- name: vhost + template: + src: apache-vhost.conf.j2 + dest: /etc/apache2/sites-available/kanboard.conf + notify: reload apache + +- name: vhost enabled + file: + src: ../sites-available/kanboard.conf + dest: /etc/apache2/sites-enabled/kanboard.conf + state: link + notify: reload apache diff --git a/templates/apache-vhost.conf.j2 b/templates/apache-vhost.conf.j2 new file mode 100644 index 0000000..e33a1a1 --- /dev/null +++ b/templates/apache-vhost.conf.j2 @@ -0,0 +1,26 @@ +{{ ansible_managed | comment }} + + + + ServerName {{kanboard_server_name}} + + SSLEngine on + SSLCertificateFile "/etc/ssl/certs/kanboard.cert.pem" + SSLCertificateKeyFile "/etc/ssl/private/kanboard.key.pem" + {% if not certificate_provider == "selfsigned" %} + SSLCertificateChainFile "/etc/ssl/certs/kanboard.chain.pem" + {% endif %} + + DocumentRoot /var/www/kanboard + + + + Options +FollowSymlinks + AllowOverride All + + + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + +