暫無描述
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.5KB

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