2023-07-16 17:28:34 +05:30
|
|
|
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
|
|
---
|
2023-07-20 13:42:30 +05:30
|
|
|
- name: Install and enable firewall
|
|
|
|
hosts: all
|
|
|
|
remote_user: atm
|
|
|
|
pre_tasks:
|
2023-07-16 17:28:34 +05:30
|
|
|
- name: Ensure all VMs are reachable
|
|
|
|
ansible.builtin.ping:
|
2023-07-20 13:42:30 +05:30
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Update all packages
|
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.apt:
|
|
|
|
update_cache: true
|
|
|
|
upgrade: safe
|
|
|
|
|
|
|
|
- name: Install git, zip, nginx, wget, curl & other utils
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.apt:
|
|
|
|
update_cache: true
|
|
|
|
pkg:
|
|
|
|
- git
|
|
|
|
- wget
|
|
|
|
- curl
|
|
|
|
- gpg
|
|
|
|
- ca-certificates
|
2023-07-20 13:42:30 +05:30
|
|
|
- ntp
|
2023-07-16 17:28:34 +05:30
|
|
|
- zip
|
|
|
|
- python3-pip
|
|
|
|
- virtualenv
|
|
|
|
- ufw
|
|
|
|
- python3-setuptools
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set logging
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
community.general.ufw:
|
|
|
|
logging: "on"
|
|
|
|
|
|
|
|
- name: Allow port 22 and enable UFW
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
community.general.ufw:
|
|
|
|
state: enabled
|
|
|
|
rule: allow
|
|
|
|
proto: tcp
|
|
|
|
port: "22"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Enable and start ufw service
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.service:
|
|
|
|
name: ufw
|
|
|
|
enabled: true
|
|
|
|
state: started
|
2023-07-20 13:42:30 +05:30
|
|
|
|
|
|
|
- name: Enable and start ufw service
|
|
|
|
become: true
|
|
|
|
ansible.builtin.service:
|
|
|
|
name: ntp
|
|
|
|
enabled: true
|
|
|
|
state: started
|