diff --git a/srv/salt/webserver/init.sls b/srv/salt/webserver/init.sls index b36f559..61a6545 100644 --- a/srv/salt/webserver/init.sls +++ b/srv/salt/webserver/init.sls @@ -13,13 +13,22 @@ install_html_file: - require: - pkg: {{ pillar['pkgs']['apache'] }} -configure_firewall: +configure_firewall_service: pkg.installed: - name: firewalld + firewalld.service: + - require: + - pkg: firewalld + - name: webserver + - ports: + - 80/tcp + - 443/tcp + +configure_firewall_zone: firewalld.present: - require: - pkg: firewalld + - firewalld: webserver - name: public - services: - - http - - https \ No newline at end of file + - webserver diff --git a/srv/salt/webserver/uninstall.sls b/srv/salt/webserver/uninstall.sls index 6d22830..a28ac3b 100644 --- a/srv/salt/webserver/uninstall.sls +++ b/srv/salt/webserver/uninstall.sls @@ -5,3 +5,12 @@ uninstall_apache: remove_html_file: file.absent: - name: /var/www/html/index.html + +unconfigure_firewall: + module.run: + - firewalld.remove_service: + - service: webserver + - zone: public + - firewalld.delete_service: + - name: webserver +