|
11 | 11 | - '{{ apache__dependent_packages }}'
|
12 | 12 |
|
13 | 13 | # Manage Apache modules [[[1
|
14 |
| - |
15 | 14 | - name: Get list of available modules
|
16 | 15 | find:
|
17 | 16 | file_type: 'file'
|
|
25 | 24 | apache__tpl_available_modules: '{{ apache__register_mods_available.files|d({}) | map(attribute="path") | map("replace", apache__config_path + "/mods-available/", "") | map("regex_replace", "\.load$", "") | list }}'
|
26 | 25 | tags: [ 'role::apache:modules' ]
|
27 | 26 |
|
28 |
| -- name: Enable/disable Apache modules |
29 |
| - apache2_module: |
30 |
| - name: '{{ item.key }}' |
31 |
| - state: '{{ (item.value.enabled |
32 |
| - if (item.value is mapping) |
33 |
| - else item.value) | bool | ternary("present", "absent") }}' |
34 |
| - force: '{{ item.value.force|d(False) | bool }}' |
35 |
| - notify: [ 'Test apache and reload' ] |
36 |
| - when: (item.key in apache__tpl_available_modules |
37 |
| - and item.value.enabled|d(True) != omit |
38 |
| - and apache__deploy_state == "present") |
39 |
| - with_dict: '{{ apache__combined_modules }}' |
40 |
| - tags: [ 'role::apache:modules' ] |
| 27 | +- include: apache_module_state.yml |
41 | 28 |
|
42 | 29 | # Manage Apache configuration snippets [[[1
|
43 | 30 | - name: Divert conf-available configuration
|
|
137 | 124 | when: (item.type|d(apache__vhost_type) not in ["divert"])
|
138 | 125 | with_flattened: '{{ apache__combined_vhosts }}'
|
139 | 126 | tags: [ 'role::apache:vhosts' ]
|
| 127 | + |
| 128 | + |
| 129 | +# Manage Apache modules, part 2 [[[1 |
| 130 | +- name: Detect if the rewrite module has been used in the active configuration |
| 131 | + shell: grep --ignore-case '^\s*RewriteEngine On' {{ apache__config_path | quote }}/sites-enabled/* {{ apache__config_path | quote }}/conf-enabled/* |
| 132 | + register: apache__register_mod_rewrite_used |
| 133 | + always_run: True |
| 134 | + failed_when: apache__register_mod_rewrite_used.rc not in [ 0, 1 ] |
| 135 | + changed_when: False |
| 136 | + when: apache__register_mod_rewrite_used is undefined |
| 137 | + |
| 138 | +- include: apache_module_state.yml |
0 commit comments