ansible-role-borgbackup/tasks/main.yml

36 lines
1 KiB
YAML
Raw Normal View History

2023-04-08 19:17:38 +02:00
---
2023-04-08 21:07:04 +02:00
- name: Install Packages
ansible.builtin.import_tasks: packages.yml
tags: packages
2023-04-08 19:17:38 +02:00
- name: Generate an OpenSSH keypair
community.crypto.openssh_keypair:
2023-04-08 21:16:17 +02:00
path: "{{ borg_ssh_key_file_path }}"
2023-04-08 21:37:24 +02:00
type: "{{ borg_ssh_key_type }}"
2023-04-08 19:17:38 +02:00
2023-04-08 21:07:04 +02:00
- name: Setup borgbase backup
ansible.builtin.import_tasks: borgbase.yml
when: borgbase is defined and borgbase
tags: borgbase
2023-04-08 19:17:38 +02:00
2023-04-08 21:07:04 +02:00
- name: Copy borgmatic configuration
ansible.builtin.template:
src: config.yaml.j2
dest: "/etc/borgmatic/{{ borgmatic_config_name }}"
mode: "0600"
2023-04-08 19:17:38 +02:00
2023-04-08 21:07:04 +02:00
- name: Add single Cron job for borgmatic
ansible.builtin.cron:
name: "{{ borgmatic_timer_cron_name }}"
hour: "{{ borgmatic_timer_hour }}"
minute: "{{ borgmatic_timer_minute }}"
user: "{{ borg_user }}"
cron_file: "{{ borgmatic_timer_cron_name }}"
job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
2023-04-08 21:52:23 +02:00
- name: Init repo
ansible.builtin.expect:
2023-04-08 21:54:51 +02:00
command: "borgmatic init -e {{ borg_repo_key }}"
2023-04-08 21:53:16 +02:00
responses:
^.*want to continue connecting.*$: "yes"