--- # Installs the ownCloud personal cloud software. - name: Install ownCloud dependencies apt: pkg={{ item }} state=present with_items: - postgresql - python-psycopg2 tags: - dependencies - name: Set password for PostgreSQL admin user become: true become_user: postgres postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes - name: Create database user for ownCloud postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ owncloud_db_username }} password="{{ owncloud_db_password }}" role_attr_flags=CREATEDB state=present - name: Ensure repository key for ownCloud is in place apt_key: url=https://download.owncloud.org/download/repositories/stable/Debian_8.0/Release.key state=present tags: - dependencies - name: Add ownCloud repository apt_repository: repo='deb http://download.owncloud.org/download/repositories/stable/Debian_8.0/ /' tags: - dependencies - name: Install ownCloud apt: pkg=owncloud-files update_cache=yes tags: - dependencies - name: Ensure ownCloud directory is in place file: state=directory path=/var/www/owncloud - name: Move ownCloud data to user-data filesystem command: mv /var/www/owncloud/data /data/owncloud-data creates=/data/owncloud-data - file: src=/data/owncloud-data dest=/var/www/owncloud/data owner=www-data group=www-data state=link - name: Configure Apache for ownCloud template: src=etc_apache2_sites-available_owncloud.j2 dest=/etc/apache2/sites-available/owncloud.conf group=root notify: restart apache - name: Enable ownCloud site command: a2ensite owncloud.conf creates=/etc/apache2/sites-enabled/owncloud.conf notify: restart apache - name: Install ownCloud cronjob cron: name="ownCloud" user="www-data" minute="*/5" job="php -f /var/www/owncloud/cron.php > /dev/null"