Playbooks for fire wall and refreshing nginx

This commit is contained in:
shockrah 2024-04-28 16:46:30 -07:00
parent 5905deb319
commit dffccd4b86
4 changed files with 52 additions and 0 deletions

View File

@ -1,4 +1,5 @@
server {
listen 80;
root /opt/nginx/shockrah.xyz;
index index.html;
server_name shockrah.xyz;

View File

@ -0,0 +1,29 @@
---
- hosts: webhost
remote_user: root
vars:
websites:
- shockrah.xyz
- temper.tv
- resume.shockrah.xyz
tasks:
- name: Upload configs
copy:
src: "../files/{{ item }}.conf"
dest: "/etc/nginx/sites-available/{{ item }}"
loop: "{{ websites }}"
- name: Enable the site configs with sym links
file:
src: "/etc/nginx/sites-available/{{ item }}"
dest: "/etc/nginx/sites-enabled/{{ item }}"
state: link
loop: "{{ websites }}"
- name: Ensure no default available
file:
path: /etc/nginx/sites-enabled/default
state: absent
- name: Restart nginx conf to pick up new config changes
service:
name: nginx
state: restarted

View File

@ -0,0 +1,7 @@
---
- hosts: webhost
remote_user: root
tasks:
- name: Setup UFW
import_tasks: ../tasks/ufw-setup.yml

View File

@ -0,0 +1,15 @@
- name: SSH Limit in fireweall
community.general.ufw:
rule: limit
port: ssh
proto: tcp
- name: Allow web traffic as needed
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: tcp
loop:
- 80
- 443