further work on webserver state

- rename apache->webserver state
- configure firewall rules to permit http/https
- fix index.html path
This commit is contained in:
John Bowdre 2023-03-27 10:38:35 -05:00
parent c63091e3a7
commit 62bd4a6f35
5 changed files with 37 additions and 8 deletions

View file

@ -1,7 +0,0 @@
install_apache:
pkg.installed:
- name: {{ pillar['pkgs']['apache'] }}
service.running:
- require:
- pkg: {{ pillar['pkgs']['apache'] }}
- name: {{ pillar['pkgs']['apache'] }}

View file

@ -6,4 +6,4 @@ base:
- users
'roles:web':
- match: grain
- apache
- webserver

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<head><title>Salt rocks</title></head>
<body>
<h1>This file brought to you by Salt</h1>
</body>
</html>

View file

@ -0,0 +1,25 @@
install_apache:
pkg.installed:
- name: {{ pillar['pkgs']['apache'] }}
service.running:
- name: {{ pillar['pkgs']['apache'] }}
- require:
- pkg: {{ pillar['pkgs']['apache'] }}
install_html_file:
file.managed:
- name: /var/www/html/index.html
- source: salt://webserver/index.html
- require:
- pkg: {{ pillar['pkgs']['apache'] }}
configure_firewall:
pkg.installed:
- name: firewalld
firewalld.present:
- require:
- pkg: firewalld
- name: public
- services:
- http
- https

View file

@ -1,3 +1,7 @@
uninstall_apache:
pkg.removed:
- name: {{ pillar['pkgs']['apache'] }}
remove_html_file:
file.absent:
- name: /var/www/html/index.html