diff --git a/tasks/configure-Debian.yml b/tasks/configure-Debian.yml index 2f2b298..e115e61 100644 --- a/tasks/configure-Debian.yml +++ b/tasks/configure-Debian.yml @@ -36,7 +36,7 @@ group: root mode: 0644 notify: restart apache - when: apache_create_vhosts + when: apache_create_vhosts | bool - name: Add vhost symlink in sites-enabled. file: @@ -44,7 +44,7 @@ dest: "{{ apache_conf_path }}/sites-enabled/{{ apache_vhosts_filename }}" state: link notify: restart apache - when: apache_create_vhosts + when: apache_create_vhosts | bool - name: Remove default vhost in sites-enabled. file: diff --git a/tasks/configure-RedHat.yml b/tasks/configure-RedHat.yml index 1483e9b..944db2f 100644 --- a/tasks/configure-RedHat.yml +++ b/tasks/configure-RedHat.yml @@ -21,4 +21,16 @@ group: root mode: 0644 notify: restart apache - when: apache_create_vhosts + when: apache_create_vhosts | bool + +- name: Check if localhost cert exists (RHEL 8 and later). + stat: + path: /etc/pki/tls/certs/localhost.crt + register: localhost_cert + when: ansible_distribution_major_version >= 8 + +- name: Ensure httpd certs are installed (RHEL 8 and later). + command: /usr/libexec/httpd-ssl-gencerts + when: + - ansible_distribution_major_version >= 8 + - not localhost_cert.stat.exists diff --git a/tasks/configure-Solaris.yml b/tasks/configure-Solaris.yml index 76d32e6..b6c121b 100644 --- a/tasks/configure-Solaris.yml +++ b/tasks/configure-Solaris.yml @@ -16,4 +16,4 @@ group: root mode: 0644 notify: restart apache - when: apache_create_vhosts + when: apache_create_vhosts | bool diff --git a/tasks/configure-Suse.yml b/tasks/configure-Suse.yml index 77e1111..54d4d1c 100644 --- a/tasks/configure-Suse.yml +++ b/tasks/configure-Suse.yml @@ -21,4 +21,4 @@ group: root mode: 0644 notify: restart apache - when: apache_create_vhosts + when: apache_create_vhosts | bool