selinux.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ---
  2. - name: Selinux... selinux targets
  3. sefcontext:
  4. target: "{{ item }}"
  5. setype: httpd_sys_rw_content_t
  6. state: present
  7. register: filecontext
  8. with_items:
  9. - '{{ nc_data_dir }}(/.*)?'
  10. - '{{ http_webroot }}/nextcloud/config(/.*)?'
  11. - '{{ http_webroot }}/nextcloud/apps(/.*)?'
  12. - '{{ http_webroot }}/nextcloud/custom_apps(/.*)?'
  13. - '{{ http_webroot }}/nextcloud/assets(/.*)?'
  14. - '{{ http_webroot }}/nextcloud/.htaccess'
  15. - '{{ http_webroot }}/nextcloud/.user.ini'
  16. - '{{ http_webroot }}/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?'
  17. - name: Selinux... enable seboolean settings
  18. seboolean:
  19. name: "{{ item }}"
  20. state: yes
  21. persistent: yes
  22. with_items:
  23. - httpd_can_sendmail
  24. - httpd_unified
  25. - httpd_graceful_shutdown
  26. - httpd_can_network_relay
  27. - httpd_can_network_connect
  28. - httpd_can_network_connect_db
  29. - daemons_enable_cluster_mode
  30. #- httpd_execmem
  31. ###- name: Selinux... enable seboolean settings
  32. ### command: semodule -i {{ role_path }}/files/{{ item }}
  33. ### loop:
  34. ### - httpd-to-php-fpm.pp
  35. ### - httpd-to-redis-socket.pp
  36. ### - httpd-to-upload-tmp.pp
  37. - name: Selinux... Run restore context to reload selinux
  38. shell: restorecon -R -v {{ item.target }}
  39. when: filecontext.results[item.index] is changed
  40. with_items:
  41. - { index: 0, target: '{{ nc_data_dir }}/' }
  42. - { index: 1, target: '{{ http_webroot }}/nextcloud/' }
  43. - name: Selinux... Restart {{ http_service_name }} service
  44. service:
  45. name: "{{ http_service_name }}"
  46. state: restarted