From 4bb1d838dd1542d7c8e044b9b9a8ab3ee466cbf6 Mon Sep 17 00:00:00 2001 From: strNophix Date: Wed, 23 Feb 2022 18:29:22 +0100 Subject: [PATCH] Added new index.html to install_nginx.yml --- playbooks/install_nginx.yml | 7 ++++++- playbooks/templates/index.html.j2 | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 playbooks/templates/index.html.j2 diff --git a/playbooks/install_nginx.yml b/playbooks/install_nginx.yml index 6d265a6..43b444f 100644 --- a/playbooks/install_nginx.yml +++ b/playbooks/install_nginx.yml @@ -1,4 +1,4 @@ -- hosts: nginx +- hosts: webserver become: true tasks: - name: Install nginx @@ -7,6 +7,11 @@ state: present update_cache: yes notify: restart nginx + - name: Copy over index.html + ansible.builtin.template: + src: ./templates/index.html.j2 + dest: /var/www/html/index.html + become: true handlers: - name: restart nginx diff --git a/playbooks/templates/index.html.j2 b/playbooks/templates/index.html.j2 new file mode 100644 index 0000000..c4f88f6 --- /dev/null +++ b/playbooks/templates/index.html.j2 @@ -0,0 +1,17 @@ + + + + + + + Hello + + + +

Hostname: {{ ansible_facts.nodename }}

+

OS: {{ ansible_facts.distribution }} {{ ansible_facts.distribution_version }}

+

Kernel: {{ ansible_facts.kernel }}

+

Memory usage: {{ ansible_facts.memfree_mb }}/{{ ansible_facts.memtotal_mb }}MB

+

Python version: {{ ansible_facts.python_version }}

+ +