From 04c68cd410b392ae3c0493bc0d59d3a6dd920c42 Mon Sep 17 00:00:00 2001
From: Stefan Haun <tux@netz39.de>
Date: Fri, 18 Nov 2022 17:47:28 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=A2=20Show=20some=20appreciation?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

See http://www.gnuterrypratchett.com/
---
 roles/apache/files/gnu-tp.conf |  3 +++
 roles/apache/handlers/main.yml |  6 ++++++
 roles/apache/tasks/main.yml    | 18 ++++++++++++++++++
 3 files changed, 27 insertions(+)
 create mode 100644 roles/apache/files/gnu-tp.conf
 create mode 100644 roles/apache/handlers/main.yml

diff --git a/roles/apache/files/gnu-tp.conf b/roles/apache/files/gnu-tp.conf
new file mode 100644
index 0000000..8e98a61
--- /dev/null
+++ b/roles/apache/files/gnu-tp.conf
@@ -0,0 +1,3 @@
+<IfModule headers_module>
+    Header Set X-Clacks-Overhead "GNU Terry Pratchett"
+</IfModule>
diff --git a/roles/apache/handlers/main.yml b/roles/apache/handlers/main.yml
new file mode 100644
index 0000000..e307af9
--- /dev/null
+++ b/roles/apache/handlers/main.yml
@@ -0,0 +1,6 @@
+# Handlers for role apache
+---
+- name: restart apache2
+  service:
+    name: apache2
+    state: restarted
diff --git a/roles/apache/tasks/main.yml b/roles/apache/tasks/main.yml
index e29fd96..6bfa4da 100644
--- a/roles/apache/tasks/main.yml
+++ b/roles/apache/tasks/main.yml
@@ -15,3 +15,21 @@
     - headers
     - proxy_http
     - proxy_wstunnel
+
+- name: Create configuration for GNU-TP header
+  ansible.builtin.copy:
+    src: files/gnu-tp.conf
+    dest: /etc/apache2/conf-available/gnu-tp.conf
+    mode: "0644"
+    owner: root
+    group: root
+  notify: restart apache2
+
+- name: Add symlink to enable configuration
+  ansible.builtin.file:
+    src: ../conf-available/gnu-tp.conf
+    dest: /etc/apache2/conf-enabled/gnu-tp.conf
+    state: link
+    owner: root
+    group: root
+  notify: restart apache2