diff --git a/bin/borg-daily b/bin/borg-daily new file mode 100755 index 0000000..7c79586 --- /dev/null +++ b/bin/borg-daily @@ -0,0 +1,47 @@ +#!/bin/bash +######################################################################### +# Copyright (C) 2020 Akito # +# # +# 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 . # +######################################################################### +# 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="--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 /var/log \ + "${TARGET}::${ARC_NAME}" \ + / +# 2>> "${LOGFILE_LOCATION}/${LOGFILE}" + +sync diff --git a/hosts b/hosts index ab362e7..370d022 100644 --- a/hosts +++ b/hosts @@ -41,6 +41,8 @@ pis: kirk: brandine: edna: + arnie: + bart: vars: ansible_python_interpreter: /usr/bin/python3 ansible_connection: ssh @@ -86,6 +88,8 @@ servers: ollital.net: ashkente.de: olliberry.de: + mail.olli-cloud.de: + git.olli-cloud.de: vars: ansible_python_interpreter: /usr/bin/python3 ansible_connection: ssh diff --git a/installsoft.yml b/installsoft.yml new file mode 100644 index 0000000..ced8ba4 --- /dev/null +++ b/installsoft.yml @@ -0,0 +1,9 @@ +--- +- hosts: "{{ target }}" + gather_facts: false + remote_user: pi + roles: + - initpi + - log2ram + - disableswap + diff --git a/roles/initpi/tasks/main.yml b/roles/initpi/tasks/main.yml index b90fe07..ec4dba2 100644 --- a/roles/initpi/tasks/main.yml +++ b/roles/initpi/tasks/main.yml @@ -3,6 +3,12 @@ path: ~/bin state: directory +- name: create tank dir + become: true + file: + path: /tank + state: directory + - name: copy scripts copy: src: bin/{{ item }} @@ -34,6 +40,8 @@ # - yum - dnsutils - nfs-kernel-server + - vim + update_cache: yes cache_valid_time: 86400 # autoremove: yes