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

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