13 changed files with 140 additions and 2 deletions
@ -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 31d" |
||||
|
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 |
@ -0,0 +1,6 @@ |
|||||
|
--- |
||||
|
- hosts: "{{ target }}" |
||||
|
gather_facts: false |
||||
|
remote_user: pi |
||||
|
roles: |
||||
|
- installpkg |
@ -0,0 +1,7 @@ |
|||||
|
--- |
||||
|
- hosts: "{{ target }}" |
||||
|
gather_facts: false |
||||
|
remote_user: pi |
||||
|
roles: |
||||
|
- mountbackup |
||||
|
|
@ -0,0 +1,7 @@ |
|||||
|
--- |
||||
|
- hosts: "{{ target }}" |
||||
|
gather_facts: false |
||||
|
remote_user: pi |
||||
|
roles: |
||||
|
- mounttank |
||||
|
|
@ -0,0 +1,7 @@ |
|||||
|
--- |
||||
|
- hosts: "{{ target }}" |
||||
|
gather_facts: false |
||||
|
remote_user: pi |
||||
|
roles: |
||||
|
- rebootpi |
||||
|
|
@ -0,0 +1,36 @@ |
|||||
|
- name: PI Update |
||||
|
become: true |
||||
|
apt: |
||||
|
update_cache: yes |
||||
|
upgrade: dist |
||||
|
- name: Pakete installieren |
||||
|
become: true |
||||
|
apt: |
||||
|
name: |
||||
|
- neofetch |
||||
|
- htop |
||||
|
- cowsay |
||||
|
- docker.io |
||||
|
- git |
||||
|
- locate |
||||
|
# - yum |
||||
|
- dnsutils |
||||
|
- nfs-kernel-server |
||||
|
- vim |
||||
|
- lsof |
||||
|
- ripgrep |
||||
|
|
||||
|
update_cache: yes |
||||
|
cache_valid_time: 86400 |
||||
|
# autoremove: yes |
||||
|
- 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 |
||||
|
|
||||
|
|
Binary file not shown.
@ -0,0 +1,19 @@ |
|||||
|
- name: create mountpoint |
||||
|
become: true |
||||
|
file: |
||||
|
path: /backup |
||||
|
state: directory |
||||
|
- name: Insert a line at the end of a file. |
||||
|
become: true |
||||
|
lineinfile: |
||||
|
line: 192.168.178.36:/mnt/md1/backup /backup nfs defaults,user,rw 1000 1000 |
||||
|
path: /etc/fstab |
||||
|
- name: mount /backup |
||||
|
become: true |
||||
|
mount: |
||||
|
path: /backup |
||||
|
src: 192.168.178.36:/mnt/md1/backup |
||||
|
fstype: nfs |
||||
|
state: mounted |
||||
|
|
||||
|
|
@ -0,0 +1,5 @@ |
|||||
|
- name: Mount /tank |
||||
|
ansible.posix.mount: |
||||
|
become: true |
||||
|
path: /tank |
||||
|
state: mounted |
@ -0,0 +1,4 @@ |
|||||
|
- name: Neustart |
||||
|
become: true |
||||
|
reboot: |
||||
|
|
@ -0,0 +1,5 @@ |
|||||
|
- name: Unmount /tank |
||||
|
become: true |
||||
|
ansible.posix.mount: |
||||
|
path: /tank |
||||
|
state: unmounted |
@ -0,0 +1,7 @@ |
|||||
|
--- |
||||
|
- hosts: "{{ target }}" |
||||
|
gather_facts: false |
||||
|
remote_user: pi |
||||
|
roles: |
||||
|
- umounttank |
||||
|
|
Loading…
Reference in new issue