playbook.yml aktualisiert

This commit is contained in:
az 2024-05-07 22:42:16 +02:00
parent cbac698e31
commit 688ecab5cf
1 changed files with 104 additions and 102 deletions

View File

@ -1,116 +1,118 @@
--- ---
- name: ensure safe environment for exams
hosts: localhost
# to verify ufw configuration run: # to verify ufw configuration run:
# sudo ufw status verbose # sudo ufw status verbose
tasks:
- name: Install ufw
apt: package=ufw state=present
- name: Install ufw - name: Configure ufw defaults
apt: package=ufw state=present ufw: direction={{ item.direction }} policy={{ item.policy }}
with_items:
- { direction: 'incoming', policy: 'deny' }
- { direction: 'outgoing', policy: 'deny' }
- name: Configure ufw defaults # disable ipv6
ufw: direction={{ item.direction }} policy={{ item.policy }} - lineinfile:
with_items: path: /etc/default/ufw
- { direction: 'incoming', policy: 'deny' } state: present
- { direction: 'outgoing', policy: 'deny' } regexp: '^IPV6'
line: 'IPV6=no'
# disable ipv6 - name: Enable ufw logging
- lineinfile: ufw: logging=off
path: /etc/default/ufw
state: present
regexp: '^IPV6'
line: 'IPV6=no'
- name: Enable ufw logging - name: Commenting a line.
ufw: logging=off replace:
path: /etc/ufw/before.rules
regexp: '(.*limit --limit*)'
replace: '#\1'
- name: Commenting a line. - name: Allow all access to tcp port 123
replace: ufw:
path: /etc/ufw/before.rules rule: allow
regexp: '(.*limit --limit*)' port: '123'
replace: '#\1' direction: '{{ item }}'
with_items:
- in
- out
- name: Allow all access to tcp port 123 - name: Allow SSH-Access to some servers
ufw: ufw:
rule: allow rule: allow
port: '123' direction: '{{ item.direction }}'
direction: '{{ item }}' dest: '{{ item.destination }}'
with_items: port: '22'
- in with_items:
- out - { direction: 'in', destination: '10.16.109.252/32' }
- { direction: 'out', destination: '10.16.109.252/32' }
- { direction: 'in', destination: '10.16.1.1/32' }
- { direction: 'out', destination: '10.16.1.1/32' }
- { direction: 'in', destination: '162.55.5.40/32' }
- { direction: 'out', destination: '162.55.5.40/32' }
- name: Allow https-Access to some servers
ufw:
rule: allow
direction: '{{ item.direction }}'
dest: '{{ item.destination }}'
port: '443'
with_items:
- { direction: 'in', destination: '10.16.109.252/32' }
- { direction: 'out', destination: '10.16.109.252/32' }
- { direction: 'in', destination: '10.16.1.1/32' }
- { direction: 'out', destination: '10.16.1.1/32' }
- { direction: 'in', destination: '162.55.5.40/32' }
- { direction: 'out', destination: '162.55.5.40/32' }
- name: Allow SSH-Access to some servers - name: Enable ufw
ufw: ufw: state=enabled
rule: allow
direction: '{{ item.direction }}'
dest: '{{ item.destination }}'
port: '22'
with_items:
- { direction: 'in', destination: '10.16.109.252/32' }
- { direction: 'out', destination: '10.16.109.252/32' }
- { direction: 'in', destination: '10.16.1.1/32' }
- { direction: 'out', destination: '10.16.1.1/32' }
- { direction: 'in', destination: '162.55.5.40/32' }
- { direction: 'out', destination: '162.55.5.40/32' }
- name: Allow https-Access to some servers
ufw:
rule: allow
direction: '{{ item.direction }}'
dest: '{{ item.destination }}'
port: '443'
with_items:
- { direction: 'in', destination: '10.16.109.252/32' }
- { direction: 'out', destination: '10.16.109.252/32' }
- { direction: 'in', destination: '10.16.1.1/32' }
- { direction: 'out', destination: '10.16.1.1/32' }
- { direction: 'in', destination: '162.55.5.40/32' }
- { direction: 'out', destination: '162.55.5.40/32' }
- name: Enable ufw - name: Allow dns
ufw: state=enabled ufw: rule={{ item.rule }} port={{ item.port }}
with_items:
- name: Allow dns - { rule: 'allow', port: '53'}
ufw: rule={{ item.rule }} port={{ item.port }}
with_items:
- { rule: 'allow', port: '53'}
- name: start ufw service - name: start ufw service
service: service:
name: ufw name: ufw
state: restarted state: restarted
- name: purge some prior installed packages - name: purge some prior installed packages
apt: apt:
name: name:
- task-kde-desktop - task-kde-desktop
- task-german-kde-desktop - task-german-kde-desktop
- task-german-desktop - task-german-desktop
- xdg-desktop-portal-kde - xdg-desktop-portal-kde
- xdg-desktop-portal-wlr # share screen in browser - xdg-desktop-portal-wlr # share screen in browser
- kde-full - kde-full
- akonadi-backend-sqlite - akonadi-backend-sqlite
- thunderbird-l10n-de - thunderbird-l10n-de
- webext-privacy-badger - webext-privacy-badger
- webext-ublock-origin-firefox - webext-ublock-origin-firefox
- webext-ublock-origin-chromium - webext-ublock-origin-chromium
- vlc - vlc
- gimp - gimp
- inkscape - inkscape
- flameshot - flameshot
- bluefish - bluefish
- git - git
- gitk - gitk
- gitg - gitg
- nmap - nmap
- net-tools - net-tools
- ghex - ghex
- thonny - thonny
- spyder - spyder
- mu-editor - mu-editor
- dia - dia
- vym - vym
- tree - tree
- sqlite3 - sqlite3
- kicad - kicad
- kicad-doc-de - kicad-doc-de
autoremove: yes autoremove: yes
state: absent state: absent