generated from ansible/ansible_template
add the backup script programmitcally
This commit is contained in:
parent
458309da63
commit
e5b94acb46
|
@ -24,13 +24,35 @@
|
|||
when: restic_extract is changed
|
||||
|
||||
- name: "Copy the backup script"
|
||||
template:
|
||||
src: "backup-to-restic.j2"
|
||||
dest: "/home/ansible/backup-to-restic"
|
||||
directory_mode: yes
|
||||
blockinfile:
|
||||
path: "/home/ansible/backup-to-restic"
|
||||
mode: 0755
|
||||
owner: "ansible"
|
||||
group: "ansible"
|
||||
block: |
|
||||
#!/bin/bash
|
||||
export RESTIC_REPOSITORY=sftp:borg@10.7.89.117:restic
|
||||
export RESTIC_PASSWORD={{ restic_password }}
|
||||
|
||||
cd {{ docker_project_path }}
|
||||
sudo docker-compose pause
|
||||
sudo -E restic backup /home/ansible --exclude-file=/etc/restic/excludes.txt
|
||||
sudo docker-compose unpause
|
||||
when: "'docker' in group_names"
|
||||
|
||||
- name: "Copy the backup script"
|
||||
blockinfile:
|
||||
path: "/home/andreas/backup-to-restic"
|
||||
mode: 0755
|
||||
owner: "andreas"
|
||||
group: "andreas"
|
||||
block: |
|
||||
#!/bin/bash
|
||||
export RESTIC_REPOSITORY=sftp:borg@10.7.89.117:restic
|
||||
export RESTIC_PASSWORD={{ restic_password }}
|
||||
|
||||
restic backup /home/andreas --exclude-file=/etc/restic/excludes.txt
|
||||
when: "'docker' not in group_names"
|
||||
|
||||
- name: "Create the restic config dir"
|
||||
file:
|
||||
|
|
Reference in New Issue