diff --git a/roles/restic/tasks/install.yml b/roles/restic/tasks/install.yml index c38eab9..308334e 100644 --- a/roles/restic/tasks/install.yml +++ b/roles/restic/tasks/install.yml @@ -1,16 +1,18 @@ --- -- name: download restic - get_url: +- name: Download restic + ansible.builtin.get_url: url: "{{ restic_download_url }}" dest: "/tmp" + mode: 0644 -- name: uncompress restic - shell: +- name: Uncompress restic + ansible.builtin.command: cmd: "bzip2 -dc /tmp/restic_{{ restic_version }}_{{ restic_system }}_{{ restic_architecture }}.bz2 > {{ restic_path }}" + changed_when: true -- name: check restic exe - file: +- name: Check restic exe + ansible.builtin.file: path: "{{ restic_path }}" mode: 0755 owner: root diff --git a/roles/restic/tasks/main.yml b/roles/restic/tasks/main.yml index 6ccf4b1..1fc1b1d 100644 --- a/roles/restic/tasks/main.yml +++ b/roles/restic/tasks/main.yml @@ -1,29 +1,29 @@ --- ## TEMP -- name: remove borg - include_tasks: remove_borg.yml +- name: Remove borg + ansible.builtin.include_tasks: remove_borg.yml -- name: install restic - include_tasks: install.yml +- name: Install restic + ansible.builtin.include_tasks: install.yml -- name: put backup script - template: +- name: Put backup script + ansible.builtin.template: src: resticbackup.sh.j2 dest: "{{ restic_script_path }}" owner: root group: root mode: '0750' -- name: cron the backup script - cron: +- name: Cron the backup script + ansible.builtin.cron: name: "restic backup script" hour: "{{ restic_backup_hour }}" minute: "{{ restic_backup_minute }}" job: "{{ restic_script_path }}" -- name: init restic - shell: +- name: Init restic + ansible.builtin.command: cmd: "restic init && restic stats" creates: "/root/.cache/restic" environment: diff --git a/roles/restic/tasks/remove_borg.yml b/roles/restic/tasks/remove_borg.yml index c6db158..640636e 100644 --- a/roles/restic/tasks/remove_borg.yml +++ b/roles/restic/tasks/remove_borg.yml @@ -1,24 +1,24 @@ --- -- name: remove borg packet - package: +- name: Remove borg packet + ansible.builtin.package: name: borgbackup state: absent -- name: remove borg script - file: +- name: Remove borg script + ansible.builtin.file: path: /usr/local/bin/borgbackup.sh state: absent -- name: remove cache dirs - file: +- name: Remove cache dirs + ansible.builtin.file: path: "{{ item }}" state: absent loop: - "/root/.cache/borg" - "/root/.config/borg" -- name: remove cron - cron: +- name: Remove cron + ansible.builtin.cron: name: "borg backup script" state: absent