set up skeleton playbook
This commit is contained in:
parent
7503d70184
commit
7f52e47c25
70
README.md
70
README.md
|
@ -1,71 +1,5 @@
|
|||
# Beispiel Ansible
|
||||
|
||||
## Konfiguration
|
||||
## TODO
|
||||
|
||||
Du musst einmal die `host_vars/server.example.com.yml` Datei umbennenen und die `inventory` Datei anpassen um deinen Host zu erreichen.
|
||||
In `host_vars/server.example.com.yml` kannst du verschiedene Rollen konfigurieren.
|
||||
|
||||
### nftables
|
||||
In der `value:` zeile kannst du ports oder bekannte [service namen](https://wintelguy.com/port-search/) angeben die zugallessen werden sollen.
|
||||
In diesem Beispiel benutzen wir eine Whitelist um bestimmten Traffic zu erlauben.
|
||||
|
||||
### fail2ban
|
||||
Hier kann man die `jail.local` datei mit ansible generieren.
|
||||
Hier ist ein Beispiel wie die YAML Config übersetzt wird:
|
||||
```
|
||||
fail2ban_services:
|
||||
- name: sshd
|
||||
backend: systemd
|
||||
maxretry: 3
|
||||
bantime: 900
|
||||
- name: traefik-auth
|
||||
logpath: /var/log/traefik/access.log
|
||||
port: http,https
|
||||
```
|
||||
```
|
||||
[sshd]
|
||||
enabled = true
|
||||
backend = systemd
|
||||
maxretry: 3
|
||||
bantime: 900
|
||||
|
||||
[traefik-auth]
|
||||
enabled = true
|
||||
logpath = /var/log/traefik/access.log
|
||||
port = http,https
|
||||
```
|
||||
|
||||
### zfs
|
||||
Unter `devices: ` musst die die ID von deiner HDD angeben, um ein ZFS pool zu erstellen. Mit `ls -l /dev/disk/by-id` kannst du die IDs anzeigen.
|
||||
|
||||
___Hier musst du die ID von der Platte angeben, nicht von einer Partition!___
|
||||
|
||||
Das Pool (im Beispiel "tank" bennant) wird dann unter `/tank` gemountet.
|
||||
Hier kannst du dann Docker Volumes ablegen oder einfach Ordner erstellen die dann in Docker gemountet werden.
|
||||
|
||||
## Kommandos
|
||||
### Playbook ausführen
|
||||
```
|
||||
ansible-playbook site.yml
|
||||
# oder
|
||||
ansible-playbook site.yml -l hostname -t tag1,tag2
|
||||
```
|
||||
### Variable finden
|
||||
```
|
||||
ansible hostname -m debug -a 'var=nft_define_host["input tcp accepted"]'
|
||||
```
|
||||
|
||||
|
||||
## Dokumentation
|
||||
|
||||
### nftables
|
||||
- [Rolle](https://github.com/ipr-cnrs/nftables/blob/master/README.md)
|
||||
- [Dokumentation](https://wiki.nftables.org/wiki-nftables/index.php/Main_Page)
|
||||
|
||||
### fail2ban
|
||||
- [Rolle](https://github.com/Oefenweb/ansible-fail2ban/blob/master/README.md)
|
||||
- [Dokumentation](https://github.com/fail2ban/fail2ban/wiki)
|
||||
|
||||
### zfs
|
||||
- [Rolle](https://github.com/mrlesmithjr/ansible-zfs/blob/master/README.md)
|
||||
- [Dokumentation](https://openzfs.github.io/openzfs-docs/index.html)
|
||||
- [ ] Write a proper readme for the poor intern cursed with this playbook
|
||||
|
|
|
@ -1,44 +1 @@
|
|||
---
|
||||
nft_define_host:
|
||||
input tcp accepted:
|
||||
name: in_tcp_accept
|
||||
value: '{ ssh, http, https }'
|
||||
# input udp accepted:
|
||||
# name: in_udp_accept
|
||||
# value: `{ }`
|
||||
output tcp accepted:
|
||||
name: out_tcp_accept
|
||||
value: '{ ssh, http, https, hkp }'
|
||||
output udp accepted:
|
||||
name: out_udp_accept
|
||||
value: '{ bootps, domain, ntp }'
|
||||
|
||||
fail2ban_services:
|
||||
- name: sshd
|
||||
backend: systemd
|
||||
maxretry: 3
|
||||
bantime: 900
|
||||
|
||||
# - name: traefik-auth
|
||||
# logpath: /var/log/traefik/access.log
|
||||
# port: http,https
|
||||
#
|
||||
# - name: nginx
|
||||
# logpath: /var/log/nginx/error.log
|
||||
# port: http,https
|
||||
|
||||
zfs_create_pools: true
|
||||
zfs_pools:
|
||||
- name: tank
|
||||
action: create
|
||||
atime: "off"
|
||||
compression: "off"
|
||||
devices:
|
||||
# TODO: Ersetze diese zeile mit der ID von deiner Platte
|
||||
- ata-ST2000DM001-1CH164_FAKEDISK
|
||||
type: basic
|
||||
state: present
|
||||
scrub_cron:
|
||||
enable: true
|
||||
hour: "4"
|
||||
weekday: sunday
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
roles:
|
||||
- src: ipr-cnrs.nftables
|
||||
version: v2.2.1
|
||||
|
||||
- src: Oefenweb.fail2ban
|
||||
version: v4.0.8
|
||||
|
||||
- name: mrlesmithjr.ansible-zfs
|
||||
src: git+https://github.com/mrlesmithjr/ansible-zfs
|
||||
version: 9560a44
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# defaults file for basic
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# handlers file for basic
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# tasks file for basic
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# vars file for basic
|
Loading…
Reference in New Issue