Building a LAMP Server on Fedora 25 with SaltStack
A LAMP server is one of the most basic builds that you can do on Linux, and also one of the most useful. In our LAMP setup here we will have PHP 7, MariaDB and Apache. Some optional pieces, like Fail2Ban are included as well. This quick installation just gets you up and running, it does not configure SSL but does install certbot for LetsEncrypt to make it easier. This is just a LAMP starter template onto which you can deploy your own applications or files.
# cat /srv/salt/lamp.sls
install_network_packages: pkg.installed: - pkgs: - wget - unzip - firewalld - net-tools - php - mariadb - mariadb-server - mod_ssl - php-pecl-apcu - httpd - fail2ban - certbot - varnish - memcached - php-pecl-memcache - php-pecl-memcached - php-mysqlnd - php-pdo - php-gd - php-mbstring - php-imap - ImageMagick - nginx - htop - glances - ZipArchive - php-pecl-zip - php-theseer-fDOMDocument - sysstat - dnf-automatic /var/www/html/: file.directory: - user: apache - group: apache - recurse: - user - group FedoraServer: firewalld.present: - name: FedoraServer - block_icmp: - echo-reply - echo-request - default: False - masquerade: False - ports: - 22/tcp - 80/tcp - 443/tcp httpd: pkg.installed:  service.running: - require: - pkg: httpd mariadb: pkg.installed:  service.running: - require: - pkg: mariadb
After this has been run, you should have both Apache and MariaDB up and running and ready for use. Your firewall will be configured and you should be able to see a web page immediately. Of course this is overly simplistic with everything thrown into a single SLS file rather than broken up as you would expect to do in product. Also this does not set a secure password for the database server, that would be a more advanced topic to tackle using a Salt Pillar. This is a basic LAMP install, but very serviceable.
If you don't want to expose SSH at all, simply remove the line "-22/tcp" and SSH will be closed completely.
If you have your Salt Master and Salt Minion all set up, you can apply this SaLt State file with a command like this one, assuming that "lamp1" is the name of your new server.
salt 'lamp1' state.apply lamp