added the a preparing ansible playbooks for automating new servers

This commit is contained in:
rezayaghobi-dev
2026-08-23 22:11:09 +03:30
parent e8422c0006
commit aedfdbddb7
73 changed files with 2971 additions and 44 deletions

View File

@@ -0,0 +1,55 @@
---
- 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 timout configuration file.
template:
src: timout.j2
dest: /etc/profile.d/timout-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: fial2ban.j2
dest: /etc/fail2ban/jail.local
notify: Restart fail2ban