This commit is contained in:
2023-06-13 14:01:53 +02:00
parent 0cd0a71cb5
commit 09f0660299
2 changed files with 55 additions and 0 deletions

42
01_webserver_azure.yml Normal file
View File

@@ -0,0 +1,42 @@
---
- name: Configure Webserver
hosts: tag_solution_webserver_alex
become: true
vars:
websiteheader: "Ansible Playbook"
websiteauthor: "Alex"
tasks:
- name: Install Apache
ansible.builtin.dnf:
name: httpd
state: present
- name: Enable Apache
ansible.builtin.systemd:
name: httpd
enabled: true
state: started
- name: Allow http in firewall
ansible.posix.firewalld:
service: http
permanent: true
state: enabled
immediate: true
notify:
- Reload firewall
- name: Add index.html
ansible.builtin.template:
src: index.html.j2
dest: /var/www/html/index.html
owner: root
group: root
mode: "0755"
handlers:
- name: Reload firewall
ansible.builtin.service:
name: firewalld
state: reloaded

13
index.html.j2 Normal file
View File

@@ -0,0 +1,13 @@
<html>
<header>
<title>{{ websiteheader }}</title></header>
<body>
<h1>Welcome to {{ websiteheader }}</h1>
<h3>This site was created with Ansible by {{ websiteauthor }}
<p>Hosted on {{ inventory_hostname }} running {{ ansible_facts['os_family'] }}<p>
</body>
</html>