ZFS per Ansible
This commit is contained in:
parent
37170cf94c
commit
8c9f7fa79f
41 changed files with 122 additions and 50 deletions
|
@ -29,6 +29,6 @@
|
|||
from_ip: 192.168.2.0/24
|
||||
### mgrote.restic
|
||||
restic_folders_to_backup: /usr/local /etc /root /home /var/lib/jenkins
|
||||
### mgrote.install_packages
|
||||
### mgrote.apt_install_packages
|
||||
programs_extra:
|
||||
- sshpass
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
postfix_smtp_server: smtp.strato.de
|
||||
postfix_smtp_server_port: 587
|
||||
postfix_smtp_use_tls: "yes"
|
||||
### mgrote.manage_sources_apt
|
||||
### mgrote.apt_manage_sources
|
||||
manage_sources_apt_proxy_url: "acng.grote.lan:9999"
|
||||
### mgrote.restic
|
||||
restic_folders_to_backup: "/usr/local /etc /root /var/www /home"
|
||||
|
@ -79,7 +79,7 @@
|
|||
- .tmux.conf
|
||||
- .gitconfig
|
||||
- .vimrc
|
||||
### mgrote.install_packages
|
||||
### mgrote.apt_install_packages
|
||||
programs_common:
|
||||
- locales
|
||||
- python
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
ansible_install_version_pip: '2.10'
|
||||
### mgrote.restic
|
||||
restic_folders_to_backup: "/usr/local /etc /root /home"
|
||||
### mgrote.install_packages
|
||||
### mgrote.apt_install_packages
|
||||
programs_extra:
|
||||
- graphviz # für ansible-playbook-grapher
|
||||
- sshpass
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
- .bash_aliases
|
||||
- .tmux.conf
|
||||
- .gitconfig
|
||||
### mgrote.sanoid
|
||||
### mgrote.zfs_sanoid
|
||||
sanoid_datasets:
|
||||
- path: 'hdd_data_raidz/videos'
|
||||
template: 'hourly' # muss in Templates angelegt sein
|
||||
|
@ -50,7 +50,7 @@
|
|||
BATTERYLEVEL: 50
|
||||
MINUTES: 10
|
||||
NOLOGON: disable
|
||||
### mgrote.zfs_tools
|
||||
### mgrote.zfs_tools_cron
|
||||
zfs_arc_max: "12884901888"
|
||||
zfs_pools:
|
||||
- name: "ssd_vm_mirror"
|
||||
|
|
29
host_vars/pve2.grote.lan.yml
Normal file
29
host_vars/pve2.grote.lan.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
### mgrote.zfs_manage_datasets
|
||||
# "Daten"-Datasets verwalte ich händisch!
|
||||
# zfs create -o encryption=aes-256-gcm -o keyformat=passphrase hdd_data_raidz/data_crypt
|
||||
# zfs create hdd_data_raidz/videos
|
||||
# Pools müssen vorher erstellt sein!
|
||||
# SSD_VM_MIRROR
|
||||
# zpool create -f -o ashift=12 ssd_vm_mirror mirror /dev/disk/by-id/ata-ADATA_SU650_2J4420001210 /dev/disk/by-id/ata-ADATA_SU650_2J4420001241
|
||||
# HDD_VM_MIRROR
|
||||
# zpool create -f -o ashift=12 hdd_vm_mirror mirror /dev/disk/by-id/ata-WDC_WD20EACS-11BHUB0_WD-WCAZA3124223 /dev/disk/by-id/ata-WDC_WD20EZRX-00D8PB0_WD-WMC4M1682516 mirror /dev/disk/by-id/ata-WDC_WD30EZRX-00DC0B0_WD-WMC1T3979908 /dev/disk/by-id/ata-TOSHIBA_DT01ACA300_83M2DRAKS
|
||||
# HDD_DATA_RAIDZ
|
||||
# zpool create -f -o ashift=12 hdd_data_raidz raidz /dev/disk/by-id/ata-WDC_WD80EZAZ-11TDBA0_2SG991TJ /dev/disk/by-id/ata-WDC_WD80EZAZ-11TDBA0_2SGA23EJ /dev/disk/by-id/ata-ST8000DM004-2CX188_ZCT1AK0F
|
||||
zfs_datasets:
|
||||
- dataset: ssd_vm_mirror/vm
|
||||
state: present
|
||||
compression: lz4
|
||||
sync: disabled
|
||||
xattr: sa
|
||||
dnodesize: auto
|
||||
atime: on
|
||||
snapdir: hidden
|
||||
- dataset: hdd_vm_mirror/vm
|
||||
state: present
|
||||
compression: lz4
|
||||
sync: disabled
|
||||
xattr: sa
|
||||
dnodesize: auto
|
||||
atime: on
|
||||
snapdir: hidden
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- { role: mgrote.manage_sources_apt,
|
||||
- { role: mgrote.apt_manage_sources,
|
||||
tags: "apt_sources" }
|
||||
- { role: mgrote.update_packages,
|
||||
- { role: mgrote.apt_update_packages,
|
||||
tags: "updates",
|
||||
serial: 3 }
|
||||
- { role: mgrote.install_packages,
|
||||
- { role: mgrote.apt_install_packages,
|
||||
tags: "install",
|
||||
serial: 3 }
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
---
|
||||
- hosts: proxmox
|
||||
roles:
|
||||
- { role: mgrote.manage_sources_apt, tags: "apt_sources" }
|
||||
- { role: mgrote.zfs_manage_datasets, tags: "datasets" }
|
||||
- { role: mgrote.apt_manage_sources, tags: "apt_sources" }
|
||||
- { role: mgrote.apcupsd, tags: "apcupsd" }
|
||||
- { role: mgrote.smart, tags: "smart" }
|
||||
- { role: mgrote.zfs_tools, tags: "zfs_tools" }
|
||||
- { role: mgrote.zfs_tools_cron, tags: "zfs_tools" }
|
||||
- { role: mgrote.postfix, tags: "postfix" }
|
||||
- { role: mgrote.sanoid, tags: "sanoid" }
|
||||
- { role: mgrote.zfs_sanoid, tags: "sanoid" }
|
||||
- { role: mgrote.ecc-rasdaemon,
|
||||
tags: "ecc",
|
||||
when: "'pve2.grote.lan' in inventory_hostname" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## mgrote.install_packages
|
||||
## mgrote.apt_install_packages
|
||||
|
||||
### Beschreibung
|
||||
Fuehrt:
|
|
@ -1,4 +1,4 @@
|
|||
## mgrote.manage_sources_apt
|
||||
## mgrote.apt_manage_sources
|
||||
|
||||
### Beschreibung
|
||||
- Diese Rolle ersetzt die `/etc/apt/sources.list` mit einer Datei in der ein Apt-Cacher-NG gesetzt ist.
|
12
roles/mgrote.apt_update_packages/README.md
Normal file
12
roles/mgrote.apt_update_packages/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
## mgrote.apt_update_packages
|
||||
|
||||
### Beschreibung
|
||||
Fuehrt:
|
||||
1. `apt update`
|
||||
2. `apt upgrade`
|
||||
aus.
|
||||
|
||||
### Funktioniert auf
|
||||
- [x] Ubuntu (>=18.04)
|
||||
- [x] Debian
|
||||
- [x] ProxMox 6.1
|
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
manage_sources_apt_proxy_url: "" # leer = kein proxy, sonst "acng.grote.lan:9999"
|
||||
manage_sources_enterprise_repo_path: /etc/apt/sources.list.d/pve-enterprise.list # wo ist das enterprise-repo
|
||||
manage_sources_apt_repo_key_url: http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg # url zum key für no-subscription-repo
|
||||
manage_sources_apt_repo_key_path: /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg # pfad lokal zum key für no-subscription-repo
|
||||
manage_sources_apt_repo_no_subscription: deb http://{{ manage_sources_apt_proxy_url }}/download.proxmox.com/debian/pve buster pve-no-subscription # url zum für no-subscription-repo, manage_sources_apt_proxy_url wird aus der variable entnommen
|
||||
manage_sources_proxmox_base_repos: # welche debian standard repos sollen gesetzt werden, werden vorher gelöscht damit ein proxy dann gesetzt werden kann
|
||||
- repo_url: deb http://ftp.de.debian.org/debian buster main contrib
|
||||
- repo_url: deb http://ftp.de.debian.org/debian buster-updates main contrib
|
||||
- repo_url: deb http://security.debian.org buster/updates main contrib
|
||||
manage_sources_debian_repo_path: /etc/apt/sources.list.d/debian # , wol sollen die standard-repos gespeichert werden; nicht auf /etc/apt/sources setzen, diese datei wird gelöscht
|
|
@ -1,5 +1,4 @@
|
|||
## mgrote.install_packages
|
||||
|
||||
## mgrote.tmux
|
||||
### Beschreibung
|
||||
Installiert tmux und erstellt .tmux.conf.
|
||||
Setzt tmux als "Standard-Shell".
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
## mgrote.install_packages
|
||||
|
||||
### Beschreibung
|
||||
Fuehrt:
|
||||
1. `apt update`
|
||||
3. ` apt install {{ programme }}`
|
||||
2. `apt upgrade`
|
||||
aus.
|
||||
|
||||
### Funktioniert auf
|
||||
- [x] Ubuntu (>=18.04)
|
||||
- [x] Debian
|
||||
- [ ] <del>CentOS</del>
|
||||
- [x] ProxMox 6.1
|
||||
|
||||
### Variablen + Defaults
|
||||
##### Programme
|
||||
- htop
|
||||
- nano
|
||||
- mc
|
||||
- curl
|
37
roles/mgrote.zfs_manage_datasets/README.md
Normal file
37
roles/mgrote.zfs_manage_datasets/README.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
## mgrote.zfs_manage_datasets
|
||||
|
||||
### Beschreibung
|
||||
Erstellt Datasets/setzt Optionen pro Dataset.
|
||||
Kann Datasets löschen.
|
||||
Die Pools müssen vorher existieren.
|
||||
Beim ersten ausführen wird es wahrscheinlich zu Status: "changed" kommen, weil:
|
||||
```bash
|
||||
ssd_vm_mirror/vm xattr sa inherited from ssd_vm_mirror
|
||||
ssd_vm_mirror/vm xattr sa local
|
||||
```
|
||||
Die Attribute werden nicht mehr vererbt sondern als "local" gesetzt
|
||||
|
||||
### Funktioniert auf
|
||||
- [x] ProxMox 6.1
|
||||
|
||||
### Variablen + Defaults
|
||||
#### Standardwerte
|
||||
```
|
||||
state: present
|
||||
compression: lz4
|
||||
sync: standard
|
||||
xattr: on
|
||||
dnodesize: auto
|
||||
atime: off
|
||||
snapdir: hidden
|
||||
```
|
||||
#### Empfohlen für VMs
|
||||
```
|
||||
state: present
|
||||
compression: lz4
|
||||
sync: disabled
|
||||
xattr: sa
|
||||
dnodesize: auto
|
||||
atime: off
|
||||
snapdir: hidden
|
||||
```
|
3
roles/mgrote.zfs_manage_datasets/meta/main.yml
Normal file
3
roles/mgrote.zfs_manage_datasets/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
collections:
|
||||
- community.general
|
23
roles/mgrote.zfs_manage_datasets/tasks/main.yml
Normal file
23
roles/mgrote.zfs_manage_datasets/tasks/main.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
- name: create datasets
|
||||
become: true
|
||||
community.general.zfs:
|
||||
name: "{{ item.dataset }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
loop: "{{ zfs_datasets }}"
|
||||
when: zfs_datasets is defined # führe nur aus wenn die Variable gesetzt ist
|
||||
|
||||
- name: set zfs properties per datasets
|
||||
become: true
|
||||
community.general.zfs:
|
||||
name: "{{ item.dataset }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
extra_zfs_properties:
|
||||
compression: "{{ item.compression | default('lz4') }}"
|
||||
sync: "{{ item.sync | default('standard') }}"
|
||||
xattr: "{{ item.xattr | default('on') }}"
|
||||
dnodesize: "{{ item.dnodesize | default('auto') }}"
|
||||
atime: "{{ item.atime | default('off') }}"
|
||||
snapdir: "{{ item.snapdir | default('hidden') }}"
|
||||
loop: "{{ zfs_datasets }}"
|
||||
when: zfs_datasets is defined # führe nur aus wenn die Variable gesetzt ist
|
|
@ -1,4 +1,4 @@
|
|||
## mgrote.sanoid
|
||||
## mgrote.zfs_sanoid
|
||||
|
||||
### Beschreibung
|
||||
Installiert und konfiguriert sanoid.
|
|
@ -1,4 +1,4 @@
|
|||
## mgrote.zfs_tools
|
||||
## mgrote.zfs_tools_cron
|
||||
|
||||
### Beschreibung
|
||||
Aktiviert die Mail Funktion von ZED (ZFS Event Daemon).
|
Loading…
Reference in a new issue