No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

owncloud.yml 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ---
  2. # Installs the ownCloud personal cloud software
  3. # as per http://www.debiantutorials.com/how-to-install-owncloud-on-wheezy/
  4. - name: Install dependencies
  5. apt: pkg={{ item }} state=present
  6. with_items:
  7. - libapache2-mod-php5
  8. - php-apc
  9. - python-psycopg2
  10. - postgresql-9.3
  11. - name: Set postgres password
  12. command: sudo -u {{ db_admin_username }} psql -d {{ db_admin_username }} -c "ALTER USER postgres with password '{{ db_admin_password }}';"
  13. - name: Create database user for ownCloud
  14. postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ owncloud_db_username }} password="{{ owncloud_db_password }}" state=present
  15. - name: Create database for ownCloud
  16. postgresql_db: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ owncloud_db_database }} state=present owner={{ owncloud_db_username }}
  17. - name: Ensure repository key for ownCloud is in place for Debian 7
  18. apt_key: url=http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key state=present
  19. when: ansible_distribution_release == 'wheezy'
  20. - name: Add ownCloud OpenSuSE repository for Debian 7
  21. apt_repository: repo='deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/ /'
  22. when: ansible_distribution_release == 'wheezy'
  23. - name: Ensure repository key for ownCloud is in place for Ubuntu 14.04
  24. apt_key: url=http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_14.04/Release.key state=present
  25. when: ansible_distribution_release == 'trusty'
  26. - name: Add ownCloud OpenSuSE repository for Ubuntu 14.04
  27. apt_repository: repo='deb http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_14.04/ /'
  28. when: ansible_distribution_release == 'trusty'
  29. - name: Ensure repository key for ownCloud is in place for Ubuntu 12.04
  30. apt_key: url=http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/Release.key state=present
  31. when: ansible_distribution_release == 'precise'
  32. - name: Add ownCloud OpenSuSE repository for Ubuntu 12.04
  33. apt_repository: repo='deb http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/ /'
  34. when: ansible_distribution_release == 'precise'
  35. - name: Install ownCloud (possibly from OpenSuSE repository)
  36. apt: pkg=owncloud update_cache=yes
  37. - name: Owncloud www directory
  38. file: state=directory path=/var/www/owncloud
  39. - name: Store ownCloud data securely
  40. command: mv /var/www/owncloud/data /decrypted/owncloud-data creates=/decrypted/owncloud-data
  41. - file: src=/decrypted/owncloud-data dest=/var/www/owncloud/data owner=www-data group=www-data state=link
  42. - name: Enable Apache rewrite module
  43. command: a2enmod rewrite creates=/etc/apache2/mods-enabled/rewrite.load
  44. notify: restart apache
  45. - name: Enable Apache headers module
  46. command: a2enmod headers creates=/etc/apache2/mods-enabled/headers.load
  47. notify: restart apache
  48. - name: Enable Apache expires module
  49. command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
  50. notify: restart apache
  51. - name: Rename existing Apache owncloud virtualhost
  52. command: mv /etc/apache2/sites-available/owncloud /etc/apache2/sites-available/owncloud.conf removes=/etc/apache2/sites-available/owncloud
  53. - name: Remove old sites-enabled/owncloud symlink (new one will be created by a2ensite)
  54. command: rm /etc/apache2/sites-enabled/owncloud removes=/etc/apache2/sites-enabled/owncloud
  55. - name: Configure the Apache HTTP server for ownCloud
  56. template: src=etc_apache2_sites-available_owncloud.j2 dest=/etc/apache2/sites-available/owncloud.conf group=root owner=root
  57. - name: Enable the owncloud site
  58. command: a2ensite owncloud.conf creates=/etc/apache2/sites-enabled/owncloud.conf
  59. notify: restart apache
  60. - name: Install ownCloud cronjob
  61. cron: name="ownCloud" user="www-data" minute="*/5" job="php -f /var/www/owncloud/cron.php > /dev/null"