56 lines
1.2 KiB
YAML
56 lines
1.2 KiB
YAML
---
|
|
- name: Stop and Disable ufw service if started
|
|
ansible.builtin.service:
|
|
name: ufw
|
|
state: stopped
|
|
enabled: no
|
|
ignore_errors: yes # not installed on this box (confirmed: ufw: command not found)
|
|
|
|
- name: Stop and Disable postfix service if started
|
|
ansible.builtin.service:
|
|
name: postfix
|
|
state: stopped
|
|
enabled: no
|
|
ignore_errors: yes
|
|
|
|
- name: Make timeout configuration file.
|
|
template:
|
|
src: timeout.j2
|
|
dest: /etc/profile.d/timeout-settings.sh
|
|
|
|
- name: Set timezone to Asia/Tehran
|
|
community.general.timezone:
|
|
name: Asia/Tehran
|
|
notify: Restart ntp
|
|
|
|
- name: Copy ssh banner file.
|
|
copy:
|
|
src: ssh_banner
|
|
dest: /etc/issue
|
|
|
|
- name: Make sshd configuration file.
|
|
template:
|
|
src: sshd_config.j2
|
|
dest: /etc/ssh/sshd_config
|
|
notify: Restart ssh
|
|
|
|
|
|
|
|
- name: Make iptables configuration file.
|
|
template:
|
|
src: iptables.j2
|
|
dest: /etc/iptables/rules.v4
|
|
|
|
- name: restore iptables state from a file
|
|
community.general.iptables_state:
|
|
state: restored
|
|
path: /etc/iptables/rules.v4
|
|
noflush: true
|
|
notify: Restart iptables
|
|
|
|
- name: Make fail2ban configuration file.
|
|
template:
|
|
src: fail2ban.j2
|
|
dest: /etc/fail2ban/jail.local
|
|
notify: Restart fail2ban
|