Add a role to allow letsencrypt access in Apache2

This commit is contained in:
Stefan Haun 2022-09-06 14:31:52 +02:00
parent 17d7aa704a
commit 1fe6526898
4 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# Defaults for role apache-letsencrypt
---
dehydrated_location: "/usr/local/etc/dehydrated"

View file

@ -0,0 +1,6 @@
# Handlers for role apache-letsencrypt
---
- name: restart apache2
service:
name: apache2
state: restarted

View file

@ -0,0 +1,20 @@
# Tasks for role apache-letsencrypt
---
- name: Create configuration for access to dehydrated location
ansible.builtin.template:
src: templates/letsencrypt-directory.conf.j2
dest: /etc/apache2/conf-available/letsencrypt-directory.conf
mode: "0644"
owner: root
group: root
notify: restart apache2
- name: Add symlink to enable configuration
ansible.builtin.file:
src: /etc/apache2/conf-available/letsencrypt-directory.conf
dest: /etc/apache2/conf-enabled/letsencrypt-directory.conf
state: link
mode: "0644"
owner: root
group: root
notify: restart apache2

View file

@ -0,0 +1,3 @@
<Directory {{ dehydrated_location }}/challenge>
Require all granted
</Directory>