From 1db6aa5d8167b997924e4b78fdf1c6b8640db8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Tue, 21 Dec 2021 17:14:36 +0000 Subject: roles/httpd: Add healthcheck subrole --- roles/httpd_site_healthcheck/defaults/main.yml | 1 + roles/httpd_site_healthcheck/meta/main.yml | 3 ++ roles/httpd_site_healthcheck/tasks/main.yml | 23 +++++++++++++++ .../httpd_site_healthcheck/templates/httpd.conf.j2 | 6 ++++ .../httpd_site_healthcheck/templates/index.html.j2 | 34 ++++++++++++++++++++++ 5 files changed, 67 insertions(+) create mode 120000 roles/httpd_site_healthcheck/defaults/main.yml create mode 100644 roles/httpd_site_healthcheck/meta/main.yml create mode 100644 roles/httpd_site_healthcheck/tasks/main.yml create mode 100644 roles/httpd_site_healthcheck/templates/httpd.conf.j2 create mode 100644 roles/httpd_site_healthcheck/templates/index.html.j2 (limited to 'roles/httpd_site_healthcheck') 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 @@ + + + +{{ inventory_hostname }} - healtcheck + + + +

{{ inventory_hostname }} - healtcheck

+
+
Thank you for using {{ inventory_hostname }}.
+ + -- cgit v1.2.3