2014-10-22 20:41:14 +02:00
|
|
|
---
|
|
|
|
- name: Configure Apache.
|
|
|
|
lineinfile:
|
|
|
|
dest: "{{ apache_server_root }}/conf/{{ apache_daemon }}.conf"
|
|
|
|
regexp: "{{ item.regexp }}"
|
|
|
|
line: "{{ item.line }}"
|
|
|
|
state: present
|
2020-08-20 19:22:09 +02:00
|
|
|
mode: 0644
|
2016-02-29 06:32:02 +01:00
|
|
|
with_items: "{{ apache_ports_configuration_items }}"
|
2014-10-22 20:41:14 +02:00
|
|
|
notify: restart apache
|
|
|
|
|
2016-01-16 16:55:07 +01:00
|
|
|
- name: Check whether certificates defined in vhosts exist.
|
|
|
|
stat: path={{ item.certificate_file }}
|
|
|
|
register: apache_ssl_certificates
|
2016-02-29 06:32:02 +01:00
|
|
|
with_items: "{{ apache_vhosts_ssl }}"
|
2021-11-09 20:14:46 +01:00
|
|
|
no_tag: true
|
2016-01-16 16:55:07 +01:00
|
|
|
|
2014-10-22 20:41:14 +02:00
|
|
|
- name: Add apache vhosts configuration.
|
|
|
|
template:
|
2016-09-02 13:37:41 +02:00
|
|
|
src: "{{ apache_vhosts_template }}"
|
2015-01-08 18:29:36 +01:00
|
|
|
dest: "{{ apache_conf_path }}/{{ apache_vhosts_filename }}"
|
2014-10-22 20:41:14 +02:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart apache
|
2019-07-23 22:01:49 +02:00
|
|
|
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
|
2019-07-23 22:13:10 +02:00
|
|
|
when: ansible_distribution_major_version | int >= 8
|
2019-07-23 22:01:49 +02:00
|
|
|
|
|
|
|
- name: Ensure httpd certs are installed (RHEL 8 and later).
|
|
|
|
command: /usr/libexec/httpd-ssl-gencerts
|
|
|
|
when:
|
2019-07-23 22:13:10 +02:00
|
|
|
- ansible_distribution_major_version | int >= 8
|
2019-07-23 22:01:49 +02:00
|
|
|
- not localhost_cert.stat.exists
|