This Ansible role installs and maintains a Linux server that contains Nginx webserver, Mariadb database, PHP and other useful packages.
Not only can this role install a LEMP (Linux+Nginx+Mariadb+PHP) server (on first execution), but also the role provides management features using flag variables (on next executions).
This role:
- Installs iptables service
- Installs Nginx + Nginx exporter
- Installs Mariadb + Mariadb exporter
- Installs PHP
- Installs Node Exporter
- Adds cronjobs
Do these steps before using this role:
- Update authorized_keys for root user
- Change ssh port and disable PasswordAuthentication in ssh configurations (recommended)
- Copy ssl certificates and dhparams.pem to /etc/nginx/ssl/
- Ensure website files directory is copied to /usr/share/nginx/ & (for Wordpress website) Modify wp-config.php file
- Configure the Mariadb and import the database after running this playbook
To use the role, you can create your own playbook.yaml and inventory files.
Then modify vars section in your playbook.yaml file to overwrite variables.
Run the playbook.
Running this playbook will overwrite and change some configuration files.
Add the SSH port in templates/iptables.j2 file.
Feel free and don't hesitate to contribute to this repository.