diff --git a/defaults/main.yml b/defaults/main.yml index afaad58..a8d7043 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,4 @@ --- -# defaults file for skeleton restic_url: '{{ restic_url_default }}' restic_version: '0.12.1' restic_download_path: '/opt/restic' @@ -18,7 +17,7 @@ restic_dir_group: '{{ ansible_user | default(ansible_user_id) }}' # timer defaults restic_systemd_timer_randomizeddelaysec: '4h' -restic_systemd_timer_default_OnCalendar: '*-*-* 02:00:00' +restic_systemd_timer_default_oncalendar: '*-*-* 02:00:00' # perform simple version check for this role? (true is recomended) submodules_versioncheck: false diff --git a/tasks/backup.yml b/tasks/backup.yml index 086d27d..404a0a8 100644 --- a/tasks/backup.yml +++ b/tasks/backup.yml @@ -1,12 +1,12 @@ --- - name: (BACKUP) reformat dict if necessary - set_fact: + ansible.builtin.set_fact: restic_backups: "{{ restic_backups|dict2items|json_query('[*].value') }}" when: - restic_backups | type_debug == "dict" - name: (BACKUP) Create backup credentials - template: + ansible.builtin.template: src: restic_access_Linux.j2 dest: "{{ restic_script_dir }}/access-{{ item.name | replace(' ', '') }}.sh" mode: '0700' @@ -21,7 +21,7 @@ - item.repo in restic_repos - name: (BACKUP) Create backup script - template: + ansible.builtin.template: src: restic_script_Linux.j2 dest: "{{ restic_script_dir }}/backup-{{ item.name | replace(' ', '') }}.sh" mode: '0700' diff --git a/tasks/configure.yml b/tasks/configure.yml index bce46b8..db0d383 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,6 +1,6 @@ --- - name: (CONF)Initialize repository - command: '{{ restic_install_path }}/restic init' + ansible.builtin.command: '{{ restic_install_path }}/restic init' environment: RESTIC_REPOSITORY: '{{ item.value.location }}' RESTIC_PASSWORD: '{{ item.value.password }}' diff --git a/tasks/distribution/defaults.yml b/tasks/distribution/defaults.yml index 8eb12ce..d34e09a 100644 --- a/tasks/distribution/defaults.yml +++ b/tasks/distribution/defaults.yml @@ -2,5 +2,5 @@ # tasks file for skeleton - name: Message - debug: + ansible.builtin.debug: msg: 'Your {{ ansible_system }} is not supported' diff --git a/tasks/install.yml b/tasks/install.yml index e2cbb80..ecb41ce 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -7,6 +7,7 @@ url: '{{ restic_url }}' dest: '{{ restic_download_path }}/restic.bz2' force: true + mode: 0644 register: get_url_restic # TODO: This needs to become independent of the shell module to actually work @@ -26,6 +27,7 @@ ansible.builtin.command: "{{ restic_bin_bath }} version" ignore_errors: true register: restic_test_result + changed_when: false - name: (INSTALL) Remove faulty binary ansible.builtin.file: @@ -50,3 +52,4 @@ - name: (INSTALL) try restic self-update become: true ansible.builtin.command: "{{ restic_install_path }}/restic self-update" + changed_when: true diff --git a/tasks/restic_create_systemd.yml b/tasks/restic_create_systemd.yml index 2f31889..4ffaedf 100644 --- a/tasks/restic_create_systemd.yml +++ b/tasks/restic_create_systemd.yml @@ -62,5 +62,5 @@ - restic_create_schedule | bool rescue: - name: set cronjob intead of systemd - set_fact: + ansible.builtin.set_fact: restic_force_cron: true diff --git a/templates/restic.timer.j2 b/templates/restic.timer.j2 index da21b60..c628a78 100644 --- a/templates/restic.timer.j2 +++ b/templates/restic.timer.j2 @@ -2,7 +2,7 @@ Description=Run restic backup {{ item.name }} every night [Timer] -OnCalendar={{ item.schedule_oncalendar | default(restic_systemd_timer_default_OnCalendar) }} +OnCalendar={{ item.schedule_oncalendar | default(restic_systemd_timer_default_oncalendar) }} RandomizedDelaySec={{ restic_systemd_timer_randomizeddelaysec }} Persistent=true