Skip to content
Snippets Groups Projects
checks.yml 8.40 KiB
---
- name: Check that mistakes haven't been made in the variables and arrays
  block:

    - name: Check that at least one module is in apache_mods_enabled and that either mpm_event or mpm_prefork is enabled
      assert:
        that:
          - ( apache_mods_enabled is defined ) and ( apache_mods_enabled[0] is defined )
          - ( "mpm_prefork" in apache_mods_enabled ) or ( "mpm_event" in apache_mods_enabled )

    - name: Checks when mpm_event enabled
      assert:
        that:
          - ( "mpm_prefork" not in apache_mods_enabled )
          - ( "mpm_event" not in apache_mods_disabled )
          - ( "mpm_itk" not in apache_mods_disabled )
      when: ( "mpm_event" in apache_mods_enabled )

    - name: Checks when mpm_prefork enabled
      assert:
        that:
          - ( "mpm_event" not in apache_mods_enabled )
          - ( "mpm_prefork" not in apache_mods_disabled )
      when: ( "mpm_prefork" in apache_mods_enabled )

    - name: Check that there are no duplicates in the mods arrays
      assert:
        that:
          - apache_mods_enabled | unique | count == apache_mods_enabled | count
          - apache_mods_disabled | unique | count == apache_mods_disabled | count

    - name: Check that there are no duplicates in the conf arrays
      assert:
        that:
          - apache_conf_enabled | unique | count == apache_conf_enabled | count
          - apache_conf_disabled | unique | count == apache_conf_disabled | count

    - name: Check that there are no duplicates in the sites arrays
      assert:
        that:
          - apache_sites_enabled | unique | count == apache_sites_enabled | count
          - apache_sites_disabled | unique | count == apache_sites_disabled | count

    - name: apache_mods_enabled and apache_mods_disabled array checks
      block:

        - name: Debug apache_mods_enabled array
          debug:
            var: apache_mods_enabled
            verbosity: 2

        - name: Debug apache_mods_disabled array
          debug:
            var: apache_mods_disabled
            verbosity: 2

        - name: Check that no mods are enabled and disabled
          assert:
            that: mod not in apache_mods_disabled
          loop: "{{ apache_mods_enabled }}"
          loop_control:
            loop_var: mod
            label: "{{ mod }}"

        - name: Check that no mods are disabled and enabled
          assert:
            that: mod not in apache_mods_enabled
          loop: "{{ apache_mods_disabled }}"
          loop_control:
            loop_var: mod