diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2021-12-21 17:14:36 +0000 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2021-12-21 17:14:36 +0000 |
commit | 1db6aa5d8167b997924e4b78fdf1c6b8640db8fd (patch) | |
tree | d735e40462af7b585d0aef858b59018fe5addde3 /roles/httpd_site_healthcheck | |
parent | 3b046f2a5fdd2a0f02c171fb63d8328159d671ae (diff) | |
download | rules-1db6aa5d8167b997924e4b78fdf1c6b8640db8fd.tar.gz |
roles/httpd: Add healthcheck subrole
Diffstat (limited to 'roles/httpd_site_healthcheck')
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 |
5 files changed, 67 insertions, 0 deletions
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> |