Add script install path var
This commit is contained in:
parent
3631ad6c6c
commit
06b25aa678
@ -4,29 +4,31 @@
|
|||||||
vars:
|
vars:
|
||||||
borg_repo_path: "/var/backups/backup.borg/"
|
borg_repo_path: "/var/backups/backup.borg/"
|
||||||
borg_repo_encryption: "none"
|
borg_repo_encryption: "none"
|
||||||
|
borg_script_install_path: "/opt/borgbackup.sh"
|
||||||
borg_backup_paths: "/etc/ /var/spool/ --exclude=*.log"
|
borg_backup_paths: "/etc/ /var/spool/ --exclude=*.log"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Install borg backup"
|
- name: "Install borg backup"
|
||||||
apt:
|
apt:
|
||||||
name: borgbackup
|
name: borgbackup
|
||||||
state: latest
|
state: latest
|
||||||
|
|
||||||
- name: "Create backup repository"
|
- name: "Create backup repository"
|
||||||
ansible.builtin.command: borg init -e {{borg_repo_encryption}} {{borg_repo_path}}
|
ansible.builtin.command: borg init -e {{borg_repo_encryption}} {{borg_repo_path}}
|
||||||
args:
|
args:
|
||||||
creates: "{{borg_repo_path}}"
|
creates: "{{borg_repo_path}}"
|
||||||
|
|
||||||
- name: "Configure backup script"
|
- name: "Configure backup script"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: ../templates/borgbackup.j2
|
src: ../templates/borgbackup.j2
|
||||||
dest: /opt/borgbackup.sh
|
dest: "{{borg_script_install_path}}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '744'
|
mode: '744'
|
||||||
|
|
||||||
- name: "Configure cronjob"
|
- name: "Configure cronjob"
|
||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
name: "Borg backup"
|
name: "Borg backup"
|
||||||
minute: "0"
|
minute: "0"
|
||||||
hour: "1"
|
hour: "1"
|
||||||
job: "/opt/borgbackup.sh"
|
job: "{{borg_script_install_path}}"
|
||||||
|
Loading…
Reference in New Issue
Block a user