12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- - name: Clone Selfoss
- git: repo=https://github.com/SSilence/selfoss.git
- dest=/var/www/selfoss
- accept_hostkey=yes
- version={{ selfoss_version }}
-
- - name: Set selfoss ownership
- action: file owner=root group=www-data path=/var/www/selfoss recurse=yes state=directory
-
- # only data/cache, data/favicons, data/logs, data/thumbnails, data/sqlite public/ should be writeable by httpd
- - name: Set selfoss permission
- action: file path=/var/www/selfoss/{{ item }} mode=0775
- with_items:
- - data/cache
- - data/favicons
- - data/logs
- - data/thumbnails
- - data/sqlite
- - public
-
- - name: Install selfoss dependencies (PHP5 variant)
- apt: pkg={{ item }} state=present
- with_items:
- - php5
- - php5-pgsql
- - php5-gd
- when: (ansible_distribution_release != "xenial" and ansible_distribution_release != "bionic" and ansible_distribution_release != "stretch")
- tags:
- - dependencies
-
- - name: Install selfoss dependencies
- apt: pkg={{ item }} state=present
- with_items:
- - php
- - php-pgsql
- - php-gd
- when: (ansible_distribution_release == "xenial" or ansible_distribution_release == "bionic" or ansible_distribution_release == "stretch")
- tags:
- - dependencies
-
- - name: Create database user for selfoss
- postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ selfoss_db_username }} password="{{ selfoss_db_password }}" state=present
-
- - name: Create database for selfoss
- postgresql_db: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ selfoss_db_database }} state=present owner={{ selfoss_db_username }}
-
- - name: Install selfoss config.ini
- template: src=var_www_selfoss_config.ini.j2 dest=/var/www/selfoss/config.ini group=www-data owner=root mode=0640
-
- - name: Enable Apache rewrite module
- command: a2enmod rewrite creates=/etc/apache2/mods-enabled/rewrite.load
- notify: restart apache
-
- - name: Enable Apache headers module
- command: a2enmod headers creates=/etc/apache2/mods-enabled/headers.load
- notify: restart apache
-
- - name: Enable Apache expires module
- command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
- notify: restart apache
-
- - name: Rename existing Apache blog virtualhost
- command: mv /etc/apache2/sites-available/selfoss /etc/apache2/sites-available/selfoss.conf removes=/etc/apache2/sites-available/selfoss
-
- - name: Remove old sites-enabled/selfoss symlink (new one will be created by a2ensite)
- file: path=/etc/apache2/sites-enabled/selfoss state=absent
-
- - name: Configure the Apache HTTP server for selfoss
- template: src=etc_apache2_sites-available_selfoss.j2 dest=/etc/apache2/sites-available/selfoss.conf group=root owner=root
-
- - name: Enable the selfoss site
- command: a2ensite selfoss.conf creates=/etc/apache2/sites-enabled/selfoss.conf
- notify: restart apache
-
- - name: Install selfoss cronjob
- cron: name="selfoss" user="www-data" minute="*/5" job="curl --silent --show-error -k 'https://{{ selfoss_domain }}/update' > /dev/null"
-
- - name: Configure selfoss logrotate
- copy: src=etc_logrotate_selfoss dest=/etc/logrotate.d/selfoss owner=root group=root mode=0644
|