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.6KB

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