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
|
when: restic_extract is changed
|
||||||
|
|
||||||
- name: "Copy the backup script"
|
- name: "Copy the backup script"
|
||||||
template:
|
blockinfile:
|
||||||
src: "backup-to-restic.j2"
|
path: "/home/ansible/backup-to-restic"
|
||||||
dest: "/home/ansible/backup-to-restic"
|
mode: 0755
|
||||||
directory_mode: yes
|
|
||||||
owner: "ansible"
|
owner: "ansible"
|
||||||
group: "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
|
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"
|
- name: "Create the restic config dir"
|
||||||
file:
|
file:
|
||||||
|
|
Reference in New Issue