From 37cedeb4e22005b2fb3471537b3027a94765032e Mon Sep 17 00:00:00 2001
From: Chris Croome <chris@webarchitects.co.uk>
Date: Wed, 6 Sep 2023 21:31:42 +0100
Subject: [PATCH] Don't include acmesh role with molecule

---
 defaults/main.yml             |  1 +
 molecule/default/converge.yml | 70 ++++++++++++++++++++++++++++++++++-
 tasks/main.yml                |  8 ++++
 3 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/defaults/main.yml b/defaults/main.yml
index 9c6792a..cc42156 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -8,6 +8,7 @@
 #
 # 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/>.
 ---
+apache: false
 apache_user: www-data
 apache_group: www-data
 apache_document_root: /var/www/html
diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml
index e78a38f..e76ddc8 100644
--- a/molecule/default/converge.yml
+++ b/molecule/default/converge.yml
@@ -34,5 +34,73 @@
       ansible.builtin.include_role:
         name: "{{ lookup('ansible.builtin.env', 'CI_PROJECT_NAME') }}"
       vars:  # noqa var-naming[no-role-prefix]
-        openproject: true
+        apache: true
+        apache_mods_disabled:
+          - ssl
+        apache_mods_enabled:
+          - access_compat
+          - alias
+          - auth_basic
+          - authn_core
+          - authn_file
+          - authz_core
+          - authz_host
+          - authz_user
+          - autoindex
+          - deflate
+          - dir
+          - env
+          - expires
+          - filter
+          - headers
+          - http2
+          - include
+          - mime
+          - mpm_event
+          - negotiation
+          - proxy
+          - proxy_fcgi
+          - proxy_http2
+          - proxy_http
+          - proxy_wstunnel
+          - reqtimeout
+          - remoteip
+          - rewrite
+          - setenvif
+          - socache_shmcb
+          - status
+        apache_conf_disabled:
+          - le
+        apache_conf_enabled:
+          - access_compat
+          - alias
+          - auth_basic
+          - authn_core
+          - authn_file
+          - authz_core
+          - authz_host
+          - authz_user
+          - autoindex
+          - deflate
+          - dir
+          - env
+          - expires
+          - filter
+          - headers
+          - http2
+          - include
+          - mime
+          - mpm_event
+          - negotiation
+          - proxy
+          - proxy_fcgi
+          - proxy_http2
+          - proxy_http
+          - proxy_wstunnel
+          - reqtimeout
+          - remoteip
+          - rewrite
+          - setenvif
+          - socache_shmcb
+          - status
 ...
diff --git a/tasks/main.yml b/tasks/main.yml
index c471903..4aad92f 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -8,6 +8,13 @@
 #
 # 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: Apache role skipped
+  ansible.builtin.debug:
+    msg: "The tasks in the Apache role are not being run since the apache variables is not true."
+  when: not apache | bool
+  tags:
+    - apache
+
 - name: Install and configure Apache
   block:
 
@@ -157,6 +164,7 @@
         state: restarted
       when: ( "Syntax OK" in apache_configtest.stderr ) or ( apache_configtest.rc == 0 )
 
+  when: apache | bool
   tags:
     - apache
 ...
-- 
GitLab