remove unused restore script
This commit is contained in:
parent
89085c5d17
commit
fadd36625d
@ -1,6 +1,5 @@
|
||||
---
|
||||
borgbackup_required: True
|
||||
borgbackup_do_restore: False
|
||||
|
||||
borgbackup_version: "1.0.11"
|
||||
borgbackup_checksum: "sha256:fbdc0e0d6d05a0935551f2f408f370236a76b7a30d3bb90a31c3628fe3611359"
|
||||
|
@ -3,8 +3,7 @@
|
||||
- include: install.yml
|
||||
when: >
|
||||
borgbackup_required == True or
|
||||
inventory_hostname in groups.backupservers or
|
||||
restore == True
|
||||
inventory_hostname in groups.backupservers
|
||||
|
||||
- include: borg-server.yml
|
||||
when: inventory_hostname in groups.backupservers
|
||||
@ -13,8 +12,3 @@
|
||||
when: >
|
||||
borgbackup_required == True and
|
||||
inventory_hostname not in groups.backupservers
|
||||
|
||||
- include: restore.yml
|
||||
when: >
|
||||
borgbackup_do_restore == True and
|
||||
inventory_hostname not in groups.backupservers
|
||||
|
@ -1,42 +0,0 @@
|
||||
---
|
||||
- name: client | generate ssh key for this machine
|
||||
shell: if [ -f ~/.ssh/id_rsa ]; then rm -f ~/.ssh/id_rsa; fi && ssh-keygen -q -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" creates=~/.ssh/id_rsa.pub
|
||||
|
||||
- name: client | fetch ssh-key
|
||||
shell: cat /root/.ssh/id_rsa.pub
|
||||
register: sshkey
|
||||
changed_when: False
|
||||
|
||||
- name: client | write passphrase
|
||||
lineinfile:
|
||||
dest: "/root/.borg.passphrase"
|
||||
state: "present"
|
||||
line: 'export BORG_PASSPHRASE="{{ borg_passphrase }}"'
|
||||
create: "yes"
|
||||
|
||||
- name: client | template sshconfig for backup-hosts (no strict key checking)
|
||||
template:
|
||||
src: "ssh.config.j2"
|
||||
dest: "/root/.ssh/config"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
|
||||
- name: client | place sshpubkey on the backupserver
|
||||
authorized_key:
|
||||
user: "{{ borg_user }}"
|
||||
key: "{{ sshkey.stdout }}"
|
||||
key_options: 'command="cd {{ borg_pool }}/{{ restore_from_vm }};borg serve --restrict-to-path {{ borg_pool }}/{{ restore_from_vm }}",no-port-forwarding,no-X11-forwarding,no-pty,no-agent-forwarding,no-user-rc'
|
||||
delegate_to: "{{ item }}"
|
||||
with_items: "{{ groups.backupservers }}"
|
||||
|
||||
- name: client | check for mysql
|
||||
stat: path=/var/lib/automysqlbackup
|
||||
register: automysql
|
||||
|
||||
- name: client | put wrapper script
|
||||
template:
|
||||
src: "borg-restore-from.sh.j2"
|
||||
dest: "/usr/local/bin/borg-restore-from"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0744"
|
@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ] || [ ! -z "$2" ]
|
||||
then
|
||||
printf "Possible: info | list | mount \n\n"
|
||||
fi
|
||||
|
||||
# Sourcing the backup-passphrase
|
||||
|
||||
. /root/.borg.passphrase
|
||||
|
||||
# Small helper commands, like listing backups, will help us in the future :)
|
||||
|
||||
if [ "$1" = "info" ]
|
||||
then
|
||||
if [ -z "$2" ]; then printf "run $0 with list and use the backup-tag to request information\n"; exit 1; fi
|
||||
{% for host in groups.backupservers %}
|
||||
REPOSITORY={{ borg_user }}@{{ restore_backup_server }}:{{ borg_pool }}/{{ restore_from_vm }}
|
||||
/usr/local/bin/borg info $REPOSITORY::$2
|
||||
{% endfor %}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "mount" ]
|
||||
then
|
||||
if [ -z "$2" ]; then printf "Select the backup-server\n"; exit 1; fi
|
||||
if [ -z "$3" ]; then printf "Select the backup to mount\n"; exit 1; fi
|
||||
if [ -z "$4" ]; then printf "Select the path to mount the backup on\n"; exit 1; fi
|
||||
{% for host in groups.backupservers %}
|
||||
REPOSITORY={{ borg_user }}@{{ restore_backup_server }}:{{ borg_pool }}/{{ restore_from_vm }}
|
||||
/usr/local/bin/borg mount $REPOSITORY::$3 $4
|
||||
if [ "$?" = "0" ]; then printf "Backup mounted on $4, do not forget to unmount!\n"; fi
|
||||
exit 0
|
||||
{% endfor %}
|
||||
fi
|
||||
|
||||
if [ "$1" = "list" ]
|
||||
then
|
||||
{% for host in groups.backupservers %}
|
||||
REPOSITORY={{ borg_user }}@{{ restore_backup_server }}:{{ borg_pool }}/{{ restore_from_vm }}
|
||||
printf "{{ restore_from_vm }} archives to restore on {{ host }} ( {{ restore_backup_server }} ):\n"
|
||||
/usr/local/bin/borg list -v $REPOSITORY
|
||||
{% endfor %}
|
||||
exit 0
|
||||
fi
|
Loading…
Reference in New Issue
Block a user