1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic_archiver.git synced 2024-08-16 10:09:49 +02:00

update to new ansible version

This commit is contained in:
L3D 2021-05-11 00:14:17 +02:00
parent 269c04d22f
commit 434349b770
Signed by: l3d
GPG key ID: CD08445BFF4313D1
7 changed files with 22 additions and 19 deletions

View file

@ -4,7 +4,7 @@ galaxy_info:
author: L3D
description: Role to deploy restic and setup backups.
license: MIT
min_ansible_version: 2.8
min_ansible_version: 2.11
platforms:
- name: Debian
versions:

View file

@ -1,13 +1,13 @@
---
- name: install cron
become: true
package:
ansible.builtin.package:
name: "{{ restic_archiver__package }}"
state: present
- name: setup cronjob for restic with logging
become: true
cron:
ansible.builtin.cron:
name: "archive restic backup with ansible_role_restic_archiver"
job: /opt/restic-backup.sh >> /var/log/restic/restic_archiver.log
cron_file: /etc/crontab
@ -18,7 +18,7 @@
- name: setup cronjob for restic without logging
become: true
cron:
ansible.builtin.cron:
name: "archive restic backup with ansible_role_restic_archiver"
job: /opt/restic-backup.sh
cron_file: /etc/crontab

View file

@ -1,7 +1,7 @@
---
- name: create /var/log/restic/
become: true
file:
ansible.builtin.file:
path: /var/log/restic
state: directory
recurse: true
@ -11,14 +11,14 @@
- name: install logrotate
become: true
package:
ansible.builtin.package:
name: logrotate
state: present
when: restic_archiver__logrotate | bool
- name: create logrotate config
become: true
copy:
ansible.builtin.copy:
src: files/logrotate.conf
dest: /etc/logrotate.d/restic
group: "{{ restic_archiver__owner }}"

View file

@ -1,7 +1,7 @@
---
- name: install requirements
become: true
package:
ansible.builtin.package:
name:
- jq
- bsd-mailx

View file

@ -1,9 +1,10 @@
---
- include_tasks: versioncheck.yml
- name: run optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck|bool
- name: deploy restic template
template:
ansible.builtin.template:
src: templates/restic_forget_snapshots.j2
dest: /opt/restic-backup.sh
group: "{{ restic_archiver__owner }}"
@ -11,10 +12,14 @@
mode: 0700
become: true
- include_tasks: logs.yml
- name: setup logrotate
ansible.builtin.include_tasks: logs.yml
when: restic_archiver__log_output | bool
- include_tasks: cron.yml
- name: create cronjob
ansible.builtin.include_tasks: cron.yml
# todo: replace with systemd timer
- include_tasks: mail.yml
- name: install requirements for mailing
ansible.builtin.include_tasks: mail.yml
when: restic_archiver__mailsummary | bool

View file

@ -1,4 +1,7 @@
---
# Copyright (c) 2021 L3D <l3d@c3woc.de>
# this file is released with the MIT license.
# License: https://github.com/roles-ansible/ansible_role_template/blob/main/LICENSE
- name: Create directory for versionscheck
become: true
ansible.builtin.file:
@ -32,11 +35,6 @@
when:
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
- name: check if '/etc/ansible-version/' is empty
ansible.builtin.find:
paths: '/etc/ansible-version/'
register: filesFound
- name: write new version to remote disk
become: true
ansible.builtin.copy:

View file

@ -1,3 +1,3 @@
---
playbook_version_number: 43 # should be int
playbook_version_number: 44 # should be int
playbook_version_path: 'role-restic_archiver_roles-ansible_github.com.version'