Some handy links:
- Vagrant documentation.
- Ansible documentation.
- Using collections via Ansible.
- Docker with Ansible.
- How to use roles with Ansible.
- Protecting sensitive data with Ansible vault.
- Information about systemd services.
VirtualBox:
Vagrant:
$ sudo apt-get install vagrant
Pip package manager:
$ sudo apt-get install python-pip
Ansible:
$ pip install ansible
NOTE: Latest version of Ansible mostly accessible via pip. So You need to install with it!
Docker, if you want to create your own image:
- Create a VM via Vagrant.
- Changes the root password
- Updates and upgrades all apt packages
- Installs tools:
- sudo
- Midnight Commander
- htop
- nginx
- iptables
- AdoptOpenJDK 8
- OpenJDK 11
- git
- Sets the default Java version to 8
- Changes the SSH port to 2222
- Enables PEM-based authentication and block password authentication.
- Installs fail2ban and configures it to ban IPs after 3 failed SSH login attempts
- Installs mariadb container from docker-hub
- Installs a simple flask application from docker-hub
Modify ansible.cfg and inventory.ini files for your setup!
Run the following command inside the same directory as the Vagrantfile
:
$ vagrant up
Then run the playbook from the same folder as the sites.yml
:
$ ansible-playbook sites.yml
IMPORTANT NOTE: Once you run the playbooks you have to forward guest's port 2222
to host's port 2222
, because the playbook modify the default ssh port!!!
Set to run daily at 2 am using the cron job scheduling utility.
$ crontab -e
Then add this line to the file 0 2 * * * ~/mysql_dump.sh
2. Lists the three most recently modified files in the /var/log
directory.
3. Lists all the files that have been modified in the last five days in the /var/log/*
directories.
4. Reads the 15-minute load average from the /proc/loadavg
file.
:wq :) :) :)