aboutsummaryrefslogtreecommitdiffstats
path: root/roles/httpd
diff options
context:
space:
mode:
Diffstat (limited to 'roles/httpd')
-rw-r--r--roles/httpd/defaults/main.yml14
-rw-r--r--roles/httpd/meta/main.yml7
-rw-r--r--roles/httpd/tasks/main.yml26
-rw-r--r--roles/httpd/templates/httpd.conf.j217
4 files changed, 43 insertions, 21 deletions
diff --git a/roles/httpd/defaults/main.yml b/roles/httpd/defaults/main.yml
index 3b0acd0..f5e0a43 100644
--- a/roles/httpd/defaults/main.yml
+++ b/roles/httpd/defaults/main.yml
@@ -2,7 +2,19 @@
httpd_configuration_file: /etc/httpd.conf
httpd_configuration_dir: /etc/httpd.d
-httpd_chroot: /var/www
+httpd_chroot_dir: /var/www
+httpd_passwords_dir: "{{ httpd_chroot_dir }}/htpasswd"
+httpd_sites_dir: "{{ httpd_chroot_dir }}/htdocs"
httpd_user: www
httpd_group: www
+
+httpd_supported_types:
+ - application/xml xml rss
+ - image/gif gif
+ - image/jpeg jpeg jpg
+ - image/png png
+ - image/svg+xml svg
+ - text/css css
+ - text/html html htm
+ - text/plain txt pgp pub
diff --git a/roles/httpd/meta/main.yml b/roles/httpd/meta/main.yml
deleted file mode 100644
index 161e3b8..0000000
--- a/roles/httpd/meta/main.yml
+++ /dev/null
@@ -1,7 +0,0 @@
----
-
-dependencies:
- - role: httpd_pre
- tags: dependency
- - role: httpd_site_healthcheck
- tags: dependency
diff --git a/roles/httpd/tasks/main.yml b/roles/httpd/tasks/main.yml
index f946044..584ae0b 100644
--- a/roles/httpd/tasks/main.yml
+++ b/roles/httpd/tasks/main.yml
@@ -1,10 +1,34 @@
---
+- name: create httpd directory
+ ansible.builtin.file:
+ path: "{{ httpd_configuration_dir }}"
+ state: directory
+ owner: 0
+ group: 0
+ mode: "0644"
+
+- name: create passwords directory
+ ansible.builtin.file:
+ path: "{{ httpd_passwords_dir }}"
+ state: directory
+ owner: "{{ httpd_user }}"
+ group: "{{ httpd_group }}"
+ mode: "0700"
+
+- name: create sites directory
+ ansible.builtin.file:
+ path: "{{ httpd_sites_dir }}"
+ state: directory
+ owner: 0
+ group: 0
+ mode: "0755"
+
- name: retrieve all configuration files
ansible.builtin.find:
path: "{{ httpd_configuration_dir }}"
patterns: "*.conf"
- register: configuration_files
+ register: httpd_configuration_files
- name: generate httpd configuration
ansible.builtin.template:
diff --git a/roles/httpd/templates/httpd.conf.j2 b/roles/httpd/templates/httpd.conf.j2
index 6285d70..49e928d 100644
--- a/roles/httpd/templates/httpd.conf.j2
+++ b/roles/httpd/templates/httpd.conf.j2
@@ -1,18 +1,12 @@
# managed by Ansible
types {
- text/css css
- text/html html htm
- text/plain txt pgp pub
- image/gif gif
- image/jpeg jpeg jpg
- image/png png
- image/svg+xml svg
- application/xml xml rss
+{% for type in httpd_supported_types %}
+ {{ type }}
+{% endfor %}
}
-{% if inventory_hostname == __global_domain_controller %}
-server "default" {
+server "acme" {
listen on localhost port 8888
location "/.well-known/acme-challenge/*" {
@@ -24,8 +18,7 @@ server "default" {
block return 302 "https://$HTTP_HOST$REQUEST_URI"
}
}
-{% endif %}
-{% for file in configuration_files.files %}
+{% for file in httpd_configuration_files.files %}
include "{{ file.path }}"
{% endfor %}
remember that computers suck.