Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added flag to enable htaccess rewritebase #15

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,11 @@ owncloud_apps_config: []
owncloud_encryption_enabled: False
owncloud_encryption_force_encrypt_all: False

# @var owncloud_rewrite_base_enabled:description: >
# When enabled, this will add rewrite rules in .htaccess that makes
# it possible to remove the "index.php" in the URL.
# See https://doc.owncloud.com/server/admin_manual/configuration/server/config_sample_php_parameters.html#define-clean-urls-without-index-php
# @end
owncloud_rewrite_base_enabled: True

...
17 changes: 17 additions & 0 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,21 @@
loop_control:
label: "{{ item.name }}"

- name: Get current htaccess rewrite state from .htaccess file
command: "/bin/grep 'RewriteBase /' /var/www/owncloud/.htaccess"
register: owncloud_register_htaccess_rewrite_check
check_mode: no
failed_when: "owncloud_register_htaccess_rewrite_check.rc == 2"
changed_when: False
become: True
become_user: "{{ owncloud_app_user }}"

- name: Update htaccess rewrite rules
command: "{{ owncloud_occ_executable | quote }} maintenance:update:htaccess"
register: owncloud_register_occ_rewrite_htaccess_rules
failed_when: "not '.htaccess has been updated' in owncloud_register_occ_rewrite_htaccess_rules.stdout"
become: True
become_user: "{{ owncloud_app_user }}"
when: "(('RewriteBase /' in owncloud_register_htaccess_rewrite_check.stdout)|bool) != (owncloud_rewrite_base_enabled|bool)"

...
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ __owncloud_role_config:
'csrf.disabled': "{{ not owncloud_csrf_enabled }}"

skeletondirectory: "{{ owncloud_skeleton_path }}"
"htaccess.RewriteBase":
state: '{{ "present" if owncloud_rewrite_base_enabled else "absent" }}'
value: "/"

__occ_core_config:
- name: core
Expand Down