my learn ansible
in this learn i have 2 linux machine, debian 9 and centos 8, using custom hosts file as inventory
cat hosts
centos 8 come with /usr/bin/python3 not /usr/bin/python so we need add ansible_python_interpreter="/usr/bin/python3" in cent8 line
execute with command
cd ansible-learn
ansible server -m ping -i hosts
ansible deb -m ping -i hosts
ansible cent -m ping -i hosts
this section, we will choose deb9, single host, not group server
this code just update via apt, i comment centos, becouse centos 8 use python3 as default
and its uncompatible with ansible yum wich using python2
this section we need enable authorized_keys to user root sudo cp .ssh /root/ -R
ansible-playbook update.yml -l deb9
using docker-var.yml to store value and calling from install-docker.yml
ansible-playbook install-docker.yml -l deb9
now lets install ufw
ansible-playbook install-ufw.yml -l deb9
config ssh http https
if you want check systax, add --check options
ansible-playbook ufw-enable-port.yml -i hosts.dev --check
ansible-playbook ufw-enable-port.yml -i hosts.dev
secured again with fail2ban
ansible-playbook install-fail2ban.yml -l deb9
we can read who connect to server with command sudo tail -f /var/log/auth.log
and we can view realtime from fail2ban sudo tail -f /var/log/fail2ban.log
clone repo with ansible-playbook
-->