Compare commits
10 Commits
9621d1d1d4
...
master
Author | SHA1 | Date | |
---|---|---|---|
56f18119b3 | |||
30ea8282fb | |||
3a876c13a9 | |||
99a9fbc8ae | |||
64d62dcc91 | |||
11e5e16e2b | |||
a42fdacaf2 | |||
33b73344ef | |||
0be03e0bc8 | |||
a9f3b8347f |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
test
|
||||||
|
roles/initnextcloud/files/resources/.netrc
|
7
initnextcloud.yml
Normal file
7
initnextcloud.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- hosts: "{{ target }}"
|
||||||
|
gather_facts: true
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- initnextcloud
|
||||||
|
|
@@ -10,6 +10,7 @@ test:
|
|||||||
hans:
|
hans:
|
||||||
cleatus:
|
cleatus:
|
||||||
terry:
|
terry:
|
||||||
|
testsystem:
|
||||||
|
|
||||||
webs:
|
webs:
|
||||||
hosts:
|
hosts:
|
||||||
|
8
loop.yml
Normal file
8
loop.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
- hosts: "{{ target }}"
|
||||||
|
vars_files:
|
||||||
|
- loop_files.yml
|
||||||
|
gather_facts: false
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- loop
|
||||||
|
|
7
loop_files.yml
Normal file
7
loop_files.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
testfiles:
|
||||||
|
- test1.txt
|
||||||
|
- test1.json
|
||||||
|
- test2.txt
|
||||||
|
- test3.txt
|
||||||
|
- test4.dat
|
||||||
|
|
8
noloop.yml
Normal file
8
noloop.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
- hosts: "{{ target }}"
|
||||||
|
vars_files:
|
||||||
|
- loop_files.yml
|
||||||
|
gather_facts: false
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- noloop
|
||||||
|
|
6
retries.yml
Normal file
6
retries.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
- hosts: "{{ target }}"
|
||||||
|
gather_facts: false
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- retries
|
||||||
|
|
4
roles/initnextcloud/files/resources/.vimrc
Normal file
4
roles/initnextcloud/files/resources/.vimrc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set number
|
||||||
|
set ff=unix
|
||||||
|
set nocompatible
|
||||||
|
syntax on
|
4
roles/initnextcloud/files/resources/borg_dirs.txt
Normal file
4
roles/initnextcloud/files/resources/borg_dirs.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/opt
|
||||||
|
/home
|
||||||
|
/etc
|
||||||
|
/mnt/nvme
|
50
roles/initnextcloud/files/scripts/borg-daily
Executable file
50
roles/initnextcloud/files/scripts/borg-daily
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#########################################################################
|
||||||
|
# Copyright (C) 2020 Akito <the@akito.ooo> #
|
||||||
|
# #
|
||||||
|
# This program is free software: you can redistribute it and/or modify #
|
||||||
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or #
|
||||||
|
# (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, #
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
# GNU General Public License for more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License #
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||||
|
#########################################################################
|
||||||
|
# https://borgbackup.readthedocs.io/en/stable/deployment/automated-local.html
|
||||||
|
# 0.2.0
|
||||||
|
PURPOSE="SYSTEM"
|
||||||
|
TARGET_HOST=""
|
||||||
|
LOCATION="/tank/borg/"
|
||||||
|
BORG_REPO="${HOSTNAME}"
|
||||||
|
TARGET="${TARGET_HOST}${LOCATION}${BORG_REPO}"
|
||||||
|
ARC_NAME="${HOSTNAME}+${USER}:$(date +"%Y%m%dT%H%M%S")"
|
||||||
|
BORG_COMMENT="Automated \"${PURPOSE}\" backup to repository \"${BORG_REPO}\" at \"${TARGET_HOST}${LOCATION}\" issued $(date +"%Y-%m-%dT%H:%M:%S")."
|
||||||
|
BORG_OPTS="--paths-from-stdin --compression auto,lzma,9 --checkpoint-interval 900 --warning"
|
||||||
|
LOGFILE_LOCATION="/tmp"
|
||||||
|
LOGFILE="borg-${PURPOSE}_$(date +"%Y%m%dT%H%M%S").log"
|
||||||
|
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
||||||
|
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
|
||||||
|
borg create ${BORG_OPTS} \
|
||||||
|
--comment "${BORG_COMMENT}" \
|
||||||
|
--exclude /media \
|
||||||
|
--exclude /dev \
|
||||||
|
--exclude /run \
|
||||||
|
--exclude /tmp \
|
||||||
|
--exclude /sys \
|
||||||
|
--exclude /proc \
|
||||||
|
--exclude /mnt \
|
||||||
|
--exclude /tank \
|
||||||
|
--exclude /extusb \
|
||||||
|
--exclude /var/log \
|
||||||
|
"${TARGET}::${ARC_NAME}" \
|
||||||
|
< /home/pi/borg_dirs.txt
|
||||||
|
|
||||||
|
|
||||||
|
# 2>> "${LOGFILE_LOCATION}/${LOGFILE}"
|
||||||
|
|
||||||
|
sync
|
33
roles/initnextcloud/files/scripts/borg-prune
Executable file
33
roles/initnextcloud/files/scripts/borg-prune
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#########################################################################
|
||||||
|
# Copyright (C) 2020 Akito <the@akito.ooo> #
|
||||||
|
# #
|
||||||
|
# This program is free software: you can redistribute it and/or modify #
|
||||||
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or #
|
||||||
|
# (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, #
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
# GNU General Public License for more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License #
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||||
|
#########################################################################
|
||||||
|
# https://borgbackup.readthedocs.io/en/stable/deployment/automated-local.html
|
||||||
|
# 0.2.0
|
||||||
|
PURPOSE="SYSTEM"
|
||||||
|
TARGET_HOST=""
|
||||||
|
LOCATION="/tank/borg"
|
||||||
|
BORG_REPO="${HOSTNAME}"
|
||||||
|
ARC_NAME="${HOSTNAME}+${USER}:$(date +"%Y%m%dT%H%M%S")"
|
||||||
|
BORG_COMMENT="Automated \"${PURPOSE}\" backup to repository \"${BORG_REPO}\" at \"${TARGET_HOST}${LOCATION}\" issued $(date +"%Y-%m-%dT%H:%M:%S")."
|
||||||
|
BORG_OPTS="--keep-within 15d"
|
||||||
|
LOGFILE_LOCATION="/tmp"
|
||||||
|
LOGFILE="borg-${PURPOSE}_$(date +"%Y%m%dT%H%M%S").log"
|
||||||
|
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
||||||
|
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
|
||||||
|
borg prune ${BORG_OPTS} ${LOCATION}/${BORG_REPO}
|
||||||
|
|
||||||
|
sync
|
19
roles/initnextcloud/files/scripts/diskspeed.sh
Executable file
19
roles/initnextcloud/files/scripts/diskspeed.sh
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
#! /usr/bin/bash
|
||||||
|
#inspired by Sun Knudsen
|
||||||
|
|
||||||
|
# create the test files
|
||||||
|
echo "preparing tests"
|
||||||
|
sysbench fileio --file-total-size=8G prepare > /dev/null
|
||||||
|
|
||||||
|
# Test with 16K block size, random read/write
|
||||||
|
echo "run test with 16K block size"
|
||||||
|
sysbench fileio --file-block-size=16K --file-total-size=8G --file-test-mode=rndrw --threads=$(nproc) run
|
||||||
|
|
||||||
|
# Test with 1M block size, random read/write
|
||||||
|
echo "run test with 1M block size"
|
||||||
|
sysbench fileio --file-block-size=1M --file-total-size=8G --file-test-mode=rndrw --threads=$(nproc) run
|
||||||
|
|
||||||
|
# cleanup the test files
|
||||||
|
sysbench fileio --file-total-size=8G cleanup
|
||||||
|
|
||||||
|
|
4
roles/initnextcloud/files/scripts/fio_convert_svg
Executable file
4
roles/initnextcloud/files/scripts/fio_convert_svg
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
# !/usr/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
for f in ${1}*.svg; do rsvg-convert "$f" -o "${f%.svg}.png"; done
|
92
roles/initnextcloud/files/scripts/fullstress
Executable file
92
roles/initnextcloud/files/scripts/fullstress
Executable file
@@ -0,0 +1,92 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Dauer des Tests (Default: 10 Minuten, Format z.B. „5m", „600")
|
||||||
|
DURATION="${1:-10m}"
|
||||||
|
|
||||||
|
# Verzeichnisse / Geräte für File‑IO
|
||||||
|
DATA_DRIVE="${HOME}/test/sysbench" # bitte anpassen
|
||||||
|
SYSTEM_DRIVE="/mnt/nextcloud/test/sysbench" # bitte anpassen
|
||||||
|
CURRENT_DIR=$(pwd)
|
||||||
|
|
||||||
|
# Größe und Einstellungen für sysbench-File‑IO
|
||||||
|
FILE_TOTAL_SIZE="1G"
|
||||||
|
FILE_NUM="4"
|
||||||
|
TEST_MODE="rndrw"
|
||||||
|
EXTRA_FLAGS="--file-extra-flags=direct"
|
||||||
|
|
||||||
|
echo "== Vorbereitung: File‑IO Testdateien erstellen =="
|
||||||
|
echo "testmode=${TEST_MODE}"
|
||||||
|
|
||||||
|
cd ${DATA_DRIVE}
|
||||||
|
echo "preparing sysbench on ${DATA_DRIVE}"
|
||||||
|
sysbench fileio \
|
||||||
|
--file-total-size=${FILE_TOTAL_SIZE} \
|
||||||
|
--file-num=${FILE_NUM} \
|
||||||
|
--file-test-mode=${TEST_MODE} \
|
||||||
|
${EXTRA_FLAGS} \
|
||||||
|
prepare &
|
||||||
|
cd ${SYSTEM_DRIVE}
|
||||||
|
echo "preparing sysbench on ${SYSTEM_DRIVE}"
|
||||||
|
sysbench fileio \
|
||||||
|
--file-total-size=${FILE_TOTAL_SIZE} \
|
||||||
|
--file-num=${FILE_NUM} \
|
||||||
|
--file-test-mode=${TEST_MODE} \
|
||||||
|
${EXTRA_FLAGS} \
|
||||||
|
prepare
|
||||||
|
wait
|
||||||
|
echo "== Vorbereitung fertig, starte Stresstest für ${DURATION} =="
|
||||||
|
|
||||||
|
# CPU‑Stresstest
|
||||||
|
echo "running stress-ng"
|
||||||
|
stress-ng \
|
||||||
|
--cpu 8 \
|
||||||
|
--cpu-method all \
|
||||||
|
--verify \
|
||||||
|
--timeout ${DURATION} \
|
||||||
|
--metrics-brief \
|
||||||
|
> stress-ng.log &
|
||||||
|
|
||||||
|
# File‑IO auf System-Laufwerk
|
||||||
|
cd ${SYSTEM_DRIVE}
|
||||||
|
echo "running sysbench on ${SYSTEM_DRIVE}"
|
||||||
|
sysbench fileio \
|
||||||
|
--file-total-size=${FILE_TOTAL_SIZE} \
|
||||||
|
--file-num=${FILE_NUM} \
|
||||||
|
--file-test-mode=${TEST_MODE} \
|
||||||
|
${EXTRA_FLAGS} \
|
||||||
|
--file-dir=${DATA_DRIVE} \
|
||||||
|
--time=10 run \
|
||||||
|
> sysbench-nvme.log &
|
||||||
|
|
||||||
|
# File‑IO auf Daten-Laufwerk
|
||||||
|
cd ${DATA_DRIVE}
|
||||||
|
echo "running sysbench on ${DATA_DRIVE}"
|
||||||
|
sysbench fileio \
|
||||||
|
--file-total-size=${FILE_TOTAL_SIZE} \
|
||||||
|
--file-num=${FILE_NUM} \
|
||||||
|
--file-test-mode=${TEST_MODE} \
|
||||||
|
${EXTRA_FLAGS} \
|
||||||
|
--file-dir=${SYSTEM_DRIVE} \
|
||||||
|
--time=10 run \
|
||||||
|
> sysbench-sata.log &
|
||||||
|
|
||||||
|
# Auf alle Hintergrund‐Jobs warten
|
||||||
|
wait
|
||||||
|
|
||||||
|
echo "== Stresstest abgeschlossen =="
|
||||||
|
echo "Ergebnisse:"
|
||||||
|
echo " - CPU (stress-ng): see stress-ng.log"
|
||||||
|
echo " - NVMe (sysbench): see sysbench-nvme.log"
|
||||||
|
echo " - SATA (sysbench): see sysbench-sata.log"
|
||||||
|
|
||||||
|
# Clean up File‑IO Testdateien
|
||||||
|
echo "== Aufräumen: File‑IO Testdateien löschen =="
|
||||||
|
cd ${DATA_DRIVE}
|
||||||
|
sysbench fileio ${EXTRA_FLAGS} cleanup
|
||||||
|
cd ${SYSTEM_DRIVE}
|
||||||
|
sysbench fileio ${EXTRA_FLAGS} cleanup
|
||||||
|
cd ${CURRENT_DIR}
|
||||||
|
|
||||||
|
echo "Fertig."
|
||||||
|
|
11
roles/initnextcloud/files/scripts/installborg.sh
Executable file
11
roles/initnextcloud/files/scripts/installborg.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
sudo apt install python3 python3-dev python3-setuptools python3-wheel python3-pip libssl-dev openssl libacl1-dev libacl1 build-essential libfuse-dev fuse pkg-config ssh
|
||||||
|
sudo pip3 install borgbackup[fuse]
|
||||||
|
mkdir /tank/borg/${HOSTNAME}
|
||||||
|
cd /tank/borg
|
||||||
|
borg --verbose init --encryption=none $HOSTNAME
|
||||||
|
borg --verbose --progress create --stats --comment "Initial backup" /tank/borg/$HOSTNAME/::firstbackup /home/$USER
|
||||||
|
|
||||||
|
|
||||||
|
|
16
roles/initnextcloud/files/scripts/overclock_test.sh
Executable file
16
roles/initnextcloud/files/scripts/overclock_test.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
|
||||||
|
vcgencmd measure_temp
|
||||||
|
echo -n "Fan-Speed beim Start: "
|
||||||
|
cat /sys/devices/platform/cooling_fan/hwmon/hwmon2/fan1_input
|
||||||
|
|
||||||
|
sysbench cpu --cpu-max-prime=1000 --threads=4 run >/dev/null 2>&1
|
||||||
|
|
||||||
|
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
|
||||||
|
|
||||||
|
sysbench cpu --cpu-max-prime=50000 --threads=4 run
|
||||||
|
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
|
||||||
|
vcgencmd measure_temp
|
||||||
|
echo -n "Fan-Speed am Ende: "
|
||||||
|
cat /sys/devices/platform/cooling_fan/hwmon/hwmon2/fan1_input
|
15
roles/initnextcloud/files/scripts/pingbrambel.sh
Executable file
15
roles/initnextcloud/files/scripts/pingbrambel.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
bramble=(quimby hans willie kirk brandine)
|
||||||
|
|
||||||
|
|
||||||
|
for host in "${bramble[@]}"
|
||||||
|
do
|
||||||
|
ping -c 3 ${host}
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
14
roles/initnextcloud/files/scripts/run-stressberry.sh
Executable file
14
roles/initnextcloud/files/scripts/run-stressberry.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# from ansible/resources
|
||||||
|
|
||||||
|
mkdir -p /tank/stressberry/${HOSTNAME}
|
||||||
|
cd /tank/stressberry/${HOSTNAME}
|
||||||
|
|
||||||
|
SRUN=$(which stressberry-run)
|
||||||
|
SPLOT=$(which stressberry-plot)
|
||||||
|
|
||||||
|
echo "Aufruf ${SRUN}"
|
||||||
|
${SRUN} -n "${HOSTNAME}" -d 1800 -i 300 -c 4 ${HOSTNAME}.out
|
||||||
|
echo "Aufruf ${SPLOT}"
|
||||||
|
${SPLOT} ${HOSTNAME}.out -f -d 300 -f -l 400 3100 -t 25 90 -o ${HOSTNAME}.png --not-transparent
|
||||||
|
|
10
roles/initnextcloud/files/scripts/showtemp
Executable file
10
roles/initnextcloud/files/scripts/showtemp
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
cpu=$(</sys/class/thermal/thermal_zone0/temp)
|
||||||
|
|
||||||
|
vccmd=$(which vcgencmd)
|
||||||
|
gpu=$(${vccmd} measure_temp)
|
||||||
|
gpu=$(echo "${gpu}"| sed 's|temp\=||g')
|
||||||
|
|
||||||
|
echo "$(date) @ $(hostname)"
|
||||||
|
echo "-------------------------------------------"
|
||||||
|
echo "GPU => ${gpu}"
|
||||||
|
echo "CPU => $((cpu/1000))'C"
|
77
roles/initnextcloud/files/scripts/stressall
Executable file
77
roles/initnextcloud/files/scripts/stressall
Executable file
@@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Dauer des Tests (Default: 10 Minuten, Format z.B. "5m", "600")
|
||||||
|
DURATION="${1:-10m}"
|
||||||
|
|
||||||
|
# Verzeichnisse / Geräte für File‑IO
|
||||||
|
NVME_MOUNT="~/test" # bitte anpassen
|
||||||
|
SATA_MOUNT="/mnt/nextcloud/test" # bitte anpassen
|
||||||
|
|
||||||
|
# Größe und Einstellungen für sysbench-File‑IO
|
||||||
|
FILE_TOTAL_SIZE="1G"
|
||||||
|
FILE_NUM="4"
|
||||||
|
TEST_MODE="rndrw"
|
||||||
|
EXTRA_FLAGS="--file-extra-flags=direct"
|
||||||
|
|
||||||
|
echo "== Vorbereitung: File‑IO Testdateien erstellen =="
|
||||||
|
sysbench fileio \
|
||||||
|
--file-total-size=${FILE_TOTAL_SIZE} \
|
||||||
|
--file-num=${FILE_NUM} \
|
||||||
|
--file-test-mode=${TEST_MODE} \
|
||||||
|
${EXTRA_FLAGS} \
|
||||||
|
--file-dir=${NVME_MOUNT} prepare &
|
||||||
|
sysbench fileio \
|
||||||
|
--file-total-size=${FILE_TOTAL_SIZE} \
|
||||||
|
--file-num=${FILE_NUM} \
|
||||||
|
--file-test-mode=${TEST_MODE} \
|
||||||
|
${EXTRA_FLAGS} \
|
||||||
|
--file-dir=${SATA_MOUNT} prepare &
|
||||||
|
wait
|
||||||
|
echo "== Vorbereitung fertig, starte Stresstest für ${DURATION} =="
|
||||||
|
|
||||||
|
# CPU‑Stresstest
|
||||||
|
stress-ng \
|
||||||
|
--cpu 8 \
|
||||||
|
--cpu-method all \
|
||||||
|
--verify \
|
||||||
|
--timeout ${DURATION} \
|
||||||
|
--metrics-brief \
|
||||||
|
> stress-ng.log 2>&1 &
|
||||||
|
|
||||||
|
# File‑IO auf NVMe
|
||||||
|
sysbench fileio \
|
||||||
|
--file-total-size=${FILE_TOTAL_SIZE} \
|
||||||
|
--file-num=${FILE_NUM} \
|
||||||
|
--file-test-mode=${TEST_MODE} \
|
||||||
|
${EXTRA_FLAGS} \
|
||||||
|
--file-dir=${NVME_MOUNT} \
|
||||||
|
--time=${DURATION} run \
|
||||||
|
> sysbench-nvme.log 2>&1 &
|
||||||
|
|
||||||
|
# File‑IO auf SATA‑SSD
|
||||||
|
sysbench fileio \
|
||||||
|
--file-total-size=${FILE_TOTAL_SIZE} \
|
||||||
|
--file-num=${FILE_NUM} \
|
||||||
|
--file-test-mode=${TEST_MODE} \
|
||||||
|
${EXTRA_FLAGS} \
|
||||||
|
--file-dir=${SATA_MOUNT} \
|
||||||
|
--time=${DURATION} run \
|
||||||
|
> sysbench-sata.log 2>&1 &
|
||||||
|
|
||||||
|
# Auf alle Hintergrund‐Jobs warten
|
||||||
|
wait
|
||||||
|
|
||||||
|
echo "== Stresstest abgeschlossen =="
|
||||||
|
echo "Ergebnisse:"
|
||||||
|
echo " - CPU (stress-ng): see stress-ng.log"
|
||||||
|
echo " - NVMe (sysbench): see sysbench-nvme.log"
|
||||||
|
echo " - SATA (sysbench): see sysbench-sata.log"
|
||||||
|
|
||||||
|
# Clean up File‑IO Testdateien
|
||||||
|
echo "== Aufräumen: File‑IO Testdateien löschen =="
|
||||||
|
sysbench fileio ${EXTRA_FLAGS} --file-dir=${NVME_MOUNT} cleanup
|
||||||
|
sysbench fileio ${EXTRA_FLAGS} --file-dir=${SATA_MOUNT} cleanup
|
||||||
|
|
||||||
|
echo "Fertig."
|
||||||
|
|
21
roles/initnextcloud/files/scripts/updatesys
Executable file
21
roles/initnextcloud/files/scripts/updatesys
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
# System-Updater CC-BY Olli Graf
|
||||||
|
# V 1.6 2019
|
||||||
|
|
||||||
|
VERSION="1.7"
|
||||||
|
TMPFILE="/tmp/updater.txt"
|
||||||
|
|
||||||
|
echo "Updater V ${VERSION}"
|
||||||
|
sudo rm -f ${TMPFILE}
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get dist-upgrade -y --allow-unauthenticated |tee ${TMPFILE}
|
||||||
|
sudo snap refresh
|
||||||
|
sudo apt-get autoremove -y
|
||||||
|
if grep -q linux-header ${TMPFILE}; then
|
||||||
|
echo "reboot nötig"
|
||||||
|
read -n1 -p "Neustart? (J/N)" auswahl
|
||||||
|
if [ "${auswahl}" == "j" ]; then
|
||||||
|
echo "System wird gestartet."
|
||||||
|
sudo reboot
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
27
roles/initnextcloud/tasks/dirs.yml
Normal file
27
roles/initnextcloud/tasks/dirs.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
- name: Abbrechen, wenn /mnt/nextcloud nicht gemountet ist
|
||||||
|
fail:
|
||||||
|
msg: "/mnt/nextcloud ist nicht gemountet – Playbook wird abgebrochen."
|
||||||
|
when: "'/mnt/nextcloud' not in (ansible_mounts | map(attribute='mount') | list)"
|
||||||
|
- name: create home dirs
|
||||||
|
file:
|
||||||
|
path: "~/{{ item }}"
|
||||||
|
state: directory
|
||||||
|
loop: "{{ homedirs }}"
|
||||||
|
|
||||||
|
- name: create volume dir
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
owner: pi
|
||||||
|
group: pi
|
||||||
|
mode: '0755'
|
||||||
|
loop: "{{ volumedirs }}"
|
||||||
|
|
||||||
|
- name: create nextcloud dirs
|
||||||
|
file:
|
||||||
|
path: ~/{{ item}}
|
||||||
|
state: directory
|
||||||
|
loop: "{{ ncdirs }}"
|
||||||
|
|
||||||
|
|
24
roles/initnextcloud/tasks/docker.yml
Normal file
24
roles/initnextcloud/tasks/docker.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
- name: Clone docker-compose repository
|
||||||
|
ansible.builtin.git:
|
||||||
|
repo: "{{ dockerrepo }}"
|
||||||
|
dest: "{{ dockerdir }}"
|
||||||
|
version: master
|
||||||
|
|
||||||
|
- name: Permission für Docker
|
||||||
|
become: true
|
||||||
|
file: path=/var/run/docker.sock mode=0660
|
||||||
|
# mode: 660
|
||||||
|
|
||||||
|
- name: adding user pi to docker group
|
||||||
|
become: true
|
||||||
|
user:
|
||||||
|
name: pi
|
||||||
|
groups: docker,video
|
||||||
|
|
||||||
|
|
||||||
|
- name: Run docker-compose up
|
||||||
|
community.docker.docker_compose:
|
||||||
|
project_src: '{{dockerdir }}/nextcloud'
|
||||||
|
state: present
|
||||||
|
become: true
|
||||||
|
|
13
roles/initnextcloud/tasks/install.yml
Normal file
13
roles/initnextcloud/tasks/install.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
- name: PI Update
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
upgrade: dist
|
||||||
|
- name: Pakete installieren
|
||||||
|
become: true
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: "{{ packages }}"
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
cache_valid_time: 86400
|
||||||
|
|
11
roles/initnextcloud/tasks/main.yml
Normal file
11
roles/initnextcloud/tasks/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
- include_vars: "roles/initnextcloud/vars/dirs.yml"
|
||||||
|
- include_vars: "roles/initnextcloud/vars/partuuid.yml"
|
||||||
|
- include_vars: "roles/initnextcloud/vars/pckg.yml"
|
||||||
|
- import_tasks: install.yml
|
||||||
|
- import_tasks: optional.yml
|
||||||
|
- import_tasks: mount.yml
|
||||||
|
- import_tasks: dirs.yml
|
||||||
|
- import_tasks: docker.yml
|
||||||
|
|
||||||
|
|
||||||
|
|
28
roles/initnextcloud/tasks/mount.yml
Normal file
28
roles/initnextcloud/tasks/mount.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
- name: create mount dir
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
path: "/mnt/nextcloud"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Backup der /etc/fstab anlegen
|
||||||
|
become: true
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: /etc/fstab
|
||||||
|
dest: /etc/fstab.backup.{{ ansible_date_time.iso8601 }}
|
||||||
|
remote_src: yes
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Ensure /mnt/nextcloud is mounted and in fstab
|
||||||
|
become: true
|
||||||
|
ansible.posix.mount:
|
||||||
|
path: /mnt/nextcloud
|
||||||
|
src: "PARTUUID={{ partuuid }}"
|
||||||
|
fstype: "ext4"
|
||||||
|
opts: "defaults,noatime"
|
||||||
|
state: mounted
|
||||||
|
|
||||||
|
- name: Facts aktualisieren
|
||||||
|
setup:
|
||||||
|
filter: ansible_mounts
|
||||||
|
|
13
roles/initnextcloud/tasks/optional.yml
Normal file
13
roles/initnextcloud/tasks/optional.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
- name: copy scripts
|
||||||
|
copy:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: /home/pi/bin
|
||||||
|
mode: '0755'
|
||||||
|
loop: "{{ query('fileglob', 'files/scripts/*') }}"
|
||||||
|
|
||||||
|
- name: copy resources to ~
|
||||||
|
copy:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: /home/pi
|
||||||
|
loop: "{{ query('fileglob', 'resources/*') }}"
|
||||||
|
|
19
roles/initnextcloud/vars/dirs.yml
Normal file
19
roles/initnextcloud/vars/dirs.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
dockerrepo: "https://raspithekgit.srv64.de/raspithek/docker"
|
||||||
|
dockerdir: "/home/pi/git/dockercmd"
|
||||||
|
|
||||||
|
volumedirs:
|
||||||
|
- /mnt/nextcloud
|
||||||
|
- /opt/clamav
|
||||||
|
|
||||||
|
homedirs:
|
||||||
|
- bin
|
||||||
|
- git
|
||||||
|
|
||||||
|
ncdirs:
|
||||||
|
- /mnt/nextcloud/nextcloud/apps
|
||||||
|
- /mnt/nextcloud/nextcloud/html
|
||||||
|
- /mnt/nextcloud/nextcloud//data
|
||||||
|
- /mnt/nextcloud/nextcloud/config
|
||||||
|
|
||||||
|
|
||||||
|
|
2
roles/initnextcloud/vars/partuuid.yml
Normal file
2
roles/initnextcloud/vars/partuuid.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
partuuid: "011ad286-01"
|
||||||
|
mark: "---"
|
15
roles/initnextcloud/vars/pckg.yml
Normal file
15
roles/initnextcloud/vars/pckg.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
packages:
|
||||||
|
- python3-docker
|
||||||
|
- neofetch
|
||||||
|
- htop
|
||||||
|
- cowsay
|
||||||
|
- docker.io
|
||||||
|
- docker-compose
|
||||||
|
- git
|
||||||
|
- locate
|
||||||
|
- dnsutils
|
||||||
|
- nfs-kernel-server
|
||||||
|
- vim
|
||||||
|
- lsof
|
||||||
|
- ripgrep
|
||||||
|
|
7
roles/loop/tasks/main.yml
Normal file
7
roles/loop/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
- include: ../subtasks/setuploop.yml
|
||||||
|
|
||||||
|
- name: erzeuge Testdateien
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "test/{{ item }}"
|
||||||
|
state: touch
|
||||||
|
loop: "{{ testfiles }}"
|
21
roles/noloop/tasks/main.yml
Normal file
21
roles/noloop/tasks/main.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
- include: ../subtasks/setuploop.yml
|
||||||
|
- name: erzeuge test1.txt
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "test/test1.txt"
|
||||||
|
state: touch
|
||||||
|
- name: erzeuge test1.json
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "test/test1.json"
|
||||||
|
state: touch
|
||||||
|
- name: erzeuge test2.txt
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "test/test2.txt"
|
||||||
|
state: touch
|
||||||
|
- name: erzeuge test3.txt
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "test/test3.txt"
|
||||||
|
state: touch
|
||||||
|
- name: erzeuge testr4.dat
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "test/test4.dat"
|
||||||
|
state: touch
|
8
roles/retries/tasks/main.yml
Normal file
8
roles/retries/tasks/main.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
- name: Warte bis Container läuft
|
||||||
|
docker_container_info:
|
||||||
|
name: homeassistant
|
||||||
|
register: container_info
|
||||||
|
until: container_info.container.State.Status == "running"
|
||||||
|
retries: 20
|
||||||
|
delay: 3
|
||||||
|
# Wartet bis Container vollständig gestartet ist
|
10
roles/subtasks/setuploop.yml
Normal file
10
roles/subtasks/setuploop.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: create test dir
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: test
|
||||||
|
state: directory
|
||||||
|
- name: delete test files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "test/*"
|
||||||
|
state: absent
|
||||||
|
|
11
roles/with_dict/tasks/main.yml
Normal file
11
roles/with_dict/tasks/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
- name: Benutzer mit bestimmten Shells anlegen
|
||||||
|
vars:
|
||||||
|
users:
|
||||||
|
alice: /bin/bash
|
||||||
|
bob: /bin/zsh
|
||||||
|
carol: /bin/sh
|
||||||
|
|
||||||
|
debug:
|
||||||
|
msg: "Lege neuen User an Name: {{ item.key }} Shell: {{ item.value }}"
|
||||||
|
with_dict: "{{ users }}"
|
||||||
|
|
7
roles/with_fileglob/tasks/main.yml
Normal file
7
roles/with_fileglob/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
- name: "Beispiel 1: Alle .conf Dateien in /etc auflisten"
|
||||||
|
debug:
|
||||||
|
msg: "Gefundene Konfigurationsdatei: {{ item }}"
|
||||||
|
with_fileglob:
|
||||||
|
- /etc/*.conf
|
||||||
|
|
||||||
|
|
13
roles/with_items/tasks/main.yml
Normal file
13
roles/with_items/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
- include: ../subtasks/setuploop.yml
|
||||||
|
|
||||||
|
- name: erzeuge Testdateien
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "test/{{ item }}"
|
||||||
|
state: touch
|
||||||
|
with_items:
|
||||||
|
- test1.txt
|
||||||
|
- test1.json
|
||||||
|
- test2.txt
|
||||||
|
- test3.txt
|
||||||
|
- test4.dat
|
||||||
|
|
8
roles/with_lines/tasks/main.yml
Normal file
8
roles/with_lines/tasks/main.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
- name: "Beispiel: Alle .conf Dateien in /etc auflisten"
|
||||||
|
debug:
|
||||||
|
msg: "Gefundene Konfigurationsdatei: {{ item }}"
|
||||||
|
with_lines:
|
||||||
|
- "find /etc -name '*.conf' -type f 2>/dev/null | head -5"
|
||||||
|
- ls ~
|
||||||
|
tags: [basic_example]
|
||||||
|
|
4
roles/with_sequence/tasks/main.yml
Normal file
4
roles/with_sequence/tasks/main.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
- name: "Beispiel: Zählschleife"
|
||||||
|
debug:
|
||||||
|
msg: "User {{ item }}"
|
||||||
|
with_sequence: start=1 end=5 format="user%02d"
|
6
with_dict.yml
Normal file
6
with_dict.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
- hosts: "{{ target }}"
|
||||||
|
gather_facts: false
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- with_dict
|
||||||
|
|
8
with_fileglob.yml
Normal file
8
with_fileglob.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
- hosts: "{{ target }}"
|
||||||
|
vars_files:
|
||||||
|
- loop_files.yml
|
||||||
|
gather_facts: false
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- with_fileglob
|
||||||
|
|
8
with_items.yml
Normal file
8
with_items.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
- hosts: "{{ target }}"
|
||||||
|
vars_files:
|
||||||
|
- loop_files.yml
|
||||||
|
gather_facts: false
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- with_items
|
||||||
|
|
8
with_lines.yml
Normal file
8
with_lines.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
- hosts: "{{ target }}"
|
||||||
|
vars_files:
|
||||||
|
- loop_files.yml
|
||||||
|
gather_facts: false
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- with_lines
|
||||||
|
|
8
with_sequence.yml
Normal file
8
with_sequence.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
- hosts: "{{ target }}"
|
||||||
|
vars_files:
|
||||||
|
- loop_files.yml
|
||||||
|
gather_facts: false
|
||||||
|
remote_user: pi
|
||||||
|
roles:
|
||||||
|
- with_sequence
|
||||||
|
|
Reference in New Issue
Block a user