# Copyright 2018-2023 Chris Croome
#
# This file is part of the Webarchitects Apache Ansible role.
#
# The Webarchitects Apache Ansible role is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
#
# The Webarchitects Apache Ansible role is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with the Webarchitects Apache Ansible role. If not, see <https://www.gnu.org/licenses/>.
---
- name: Verify variables starting with apache_
  block:

    - name: Debug the hostvars variable names that start with apache_
      ansible.builtin.debug:
        var: apachevarnames
        verbosity: "{% if ansible_check_mode | bool %}3{% else %}4{% endif %}"

    - name: Debug the hostvars variable names that start with apache_
      ansible.builtin.debug:
        var: apachehostvars
        verbosity: "{% if ansible_check_mode | bool %}3{% else %}4{% endif %}"

    - name: Check apache_ variables using meta/argument_specs.yml
      ansible.builtin.validate_argument_spec:
        argument_spec: "{{ (lookup('ansible.builtin.file', 'meta/argument_specs.yml') | from_yaml)['argument_specs']['main']['options'] }}"
        provided_arguments: "{{ apachehostvars }}"


  when: apache_verify | bool
  tags:
    - apache
...