Ingen beskrivning
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

selfoss.yml 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. - name: Install selfoss dependencies
  2. apt:
  3. name: "{{ packages }}"
  4. state: present
  5. vars:
  6. packages:
  7. - php
  8. - php-pgsql
  9. - php-gd
  10. - curl
  11. - unzip
  12. tags:
  13. - dependencies
  14. - name: Create Selfoss temp directory
  15. file: path=/root/selfoss state=directory
  16. - name: Download Selfoss-{{ selfoss_version }}
  17. get_url:
  18. url=https://github.com/SSilence/selfoss/releases/download/{{ selfoss_version }}/selfoss-{{ selfoss_version }}.zip
  19. dest=/root/selfoss/selfoss-{{ selfoss_version }}.zip
  20. - name: Create Selfoss unpack directory
  21. file: path=/root/selfoss/selfoss-{{ selfoss_version }} state=directory
  22. - name: Extract Selfoss archive
  23. unarchive:
  24. copy: no
  25. src: /root/selfoss/selfoss-{{ selfoss_version }}.zip
  26. dest: /root/selfoss/selfoss-{{ selfoss_version }}/
  27. creates: /root/selfoss-{{ selfoss_version }}/index.php
  28. - name: Back-Up old Selfoss data
  29. shell: cp -r /var/www/selfoss/data /root/selfoss/data_bak || true
  30. - name: Delete old Selfoss document root
  31. file: path=/var/www/selfoss state=absent
  32. - name: Copy Selfoss source to document root
  33. shell: cp -r /root/selfoss/selfoss-{{ selfoss_version }} /var/www/selfoss
  34. - name: Delete empty Selfoss data
  35. file: path=/var/www/selfoss/data state=absent
  36. - name: Restore old Selfoss data
  37. shell: cp -r /root/selfoss/data_bak /var/www/selfoss/data || cp -r /root/selfoss/selfoss-{{ selfoss_version }}/data /var/www/selfoss/data
  38. - name: Delete old Selfoss data
  39. file: path=/root/selfoss/data_bak state=absent
  40. - name: Set selfoss ownership
  41. action: file owner=www-data group=www-data path=/var/www/selfoss recurse=yes state=directory
  42. - name: Set selfoss permission
  43. action: file path=/var/www/selfoss/{{ item }} mode=0775
  44. with_items:
  45. - data/cache
  46. - data/favicons
  47. - data/fulltextrss
  48. - data/logs
  49. - data/sqlite
  50. - data/thumbnails
  51. - public
  52. - name: Create database user for selfoss
  53. postgresql_user:
  54. login_host=localhost
  55. login_user={{ db_admin_username }}
  56. login_password="{{ db_admin_password }}"
  57. name={{ selfoss_db_username }}
  58. password="{{ selfoss_db_password }}"
  59. state=present
  60. - name: Create database for selfoss
  61. postgresql_db:
  62. login_host=localhost
  63. login_user={{ db_admin_username }}
  64. login_password="{{ db_admin_password }}"
  65. name={{ selfoss_db_database }}
  66. state=present
  67. owner={{ selfoss_db_username }}
  68. - name: Install selfoss config.ini
  69. template:
  70. src=var_www_selfoss_config.ini.j2
  71. dest=/var/www/selfoss/config.ini
  72. owner=root
  73. group=www-data
  74. mode=0640
  75. - name: Enable Apache rewrite module
  76. command: a2enmod rewrite creates=/etc/apache2/mods-enabled/rewrite.load
  77. notify: restart apache
  78. - name: Enable Apache headers module
  79. command: a2enmod headers creates=/etc/apache2/mods-enabled/headers.load
  80. notify: restart apache
  81. - name: Enable Apache expires module
  82. command: a2enmod expires creates=/etc/apache2/mods-enabled/expires.load
  83. notify: restart apache
  84. - name: Create the Apache sites config files
  85. template:
  86. src=etc_apache2_sites-available_selfoss.j2
  87. dest=/etc/apache2/sites-available/selfoss_{{ item.name }}.conf
  88. owner=root
  89. group=root
  90. with_items: "{{ virtual_domains }}"
  91. - name: Enable Apache sites (creates new sites-enabled symlinks)
  92. command: a2ensite selfoss_{{ item }}.conf creates=/etc/apache2/sites-enabled/selfoss_{{ item }}.conf
  93. notify: restart apache
  94. with_items: "{{ virtual_domains | json_query('[*].name') }}"
  95. - name: Install selfoss cronjob
  96. cron:
  97. name="selfoss"
  98. user="www-data"
  99. minute="*/5"
  100. job="curl --silent --show-error -k 'https://{{ selfoss_domain }}/update' > /dev/null"
  101. - name: Configure selfoss logrotate
  102. copy:
  103. src=etc_logrotate_selfoss
  104. dest=/etc/logrotate.d/selfoss
  105. owner=root
  106. group=root
  107. mode=0644