diff options
-rw-r--r-- | roles/httpd/defaults/main.yml | 3 | ||||
-rw-r--r-- | roles/httpd/meta/main.yml | 2 | ||||
l--------- | roles/httpd_site_healthcheck/defaults/main.yml | 1 | ||||
-rw-r--r-- | roles/httpd_site_healthcheck/meta/main.yml | 3 | ||||
-rw-r--r-- | roles/httpd_site_healthcheck/tasks/main.yml | 23 | ||||
-rw-r--r-- | roles/httpd_site_healthcheck/templates/httpd.conf.j2 | 6 | ||||
-rw-r--r-- | roles/httpd_site_healthcheck/templates/index.html.j2 | 34 |
7 files changed, 72 insertions, 0 deletions
diff --git a/roles/httpd/defaults/main.yml b/roles/httpd/defaults/main.yml index e09e3cd..ce189c2 100644 --- a/roles/httpd/defaults/main.yml +++ b/roles/httpd/defaults/main.yml @@ -1,3 +1,6 @@ httpd_configuration_file: /etc/httpd.conf httpd_configuration_dir: /etc/httpd.d httpd_chroot: /var/www + +httpd_user: www +httpd_group: www diff --git a/roles/httpd/meta/main.yml b/roles/httpd/meta/main.yml index 6b163d1..20728a9 100644 --- a/roles/httpd/meta/main.yml +++ b/roles/httpd/meta/main.yml @@ -1,3 +1,5 @@ dependencies: - role: httpd_pre tags: dependency + - role: httpd_site_healthcheck + tags: dependency diff --git a/roles/httpd_site_healthcheck/defaults/main.yml b/roles/httpd_site_healthcheck/defaults/main.yml new file mode 120000 index 0000000..52d65d9 --- /dev/null +++ b/roles/httpd_site_healthcheck/defaults/main.yml @@ -0,0 +1 @@ +../../httpd/defaults/main.yml
\ No newline at end of file diff --git a/roles/httpd_site_healthcheck/meta/main.yml b/roles/httpd_site_healthcheck/meta/main.yml new file mode 100644 index 0000000..6b163d1 --- /dev/null +++ b/roles/httpd_site_healthcheck/meta/main.yml @@ -0,0 +1,3 @@ +dependencies: + - role: httpd_pre + tags: dependency diff --git a/roles/httpd_site_healthcheck/tasks/main.yml b/roles/httpd_site_healthcheck/tasks/main.yml new file mode 100644 index 0000000..10cd3c8 --- /dev/null +++ b/roles/httpd_site_healthcheck/tasks/main.yml @@ -0,0 +1,23 @@ +- name: create httpd healthcheck directory + file: + path: "{{ httpd_chroot }}/htdocs/healthcheck" + owner: "{{ httpd_user }}" + group: "{{ httpd_group }}" + mode: 0550 + state: directory + +- name: generate generate httpd healthcheck html index + template: + src: index.html.j2 + dest: "{{ httpd_chroot }}/htdocs/healthcheck/index.html" + owner: "{{ httpd_user }}" + group: "{{ httpd_group }}" + mode: 0440 + +- name: generate httpd healthcheck configuration + template: + src: httpd.conf.j2 + dest: "{{ httpd_configuration_dir }}/healthcheck.conf" + owner: 0 + group: 0 + mode: 0644 diff --git a/roles/httpd_site_healthcheck/templates/httpd.conf.j2 b/roles/httpd_site_healthcheck/templates/httpd.conf.j2 new file mode 100644 index 0000000..17ffd04 --- /dev/null +++ b/roles/httpd_site_healthcheck/templates/httpd.conf.j2 @@ -0,0 +1,6 @@ +# managed by Ansible + +server "healthcheck" { + listen on * port 8000 + root "/htdocs/healthcheck" +} diff --git a/roles/httpd_site_healthcheck/templates/index.html.j2 b/roles/httpd_site_healthcheck/templates/index.html.j2 new file mode 100644 index 0000000..c52ff41 --- /dev/null +++ b/roles/httpd_site_healthcheck/templates/index.html.j2 @@ -0,0 +1,34 @@ +<html> +<head> +<meta charset="utf-8"> +<title>{{ inventory_hostname }} - healtcheck</title> +<style> +body { + background-color: white; + color: black; + font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif; +} + +hr { + border: 0; + border-bottom: 1px dashed; +} + +@media (prefers-color-scheme: dark) { + body { + background-color: #1E1F21; + color: #EEEFF1; + } + + a { + color: #BAD7FF; + } +} +</style> +</head> +<body> +<h1>{{ inventory_hostname }} - healtcheck</h1> +<hr> +<blockquote>Thank you for using {{ inventory_hostname }}.</blockquote> +</body> +</html> |