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 author: L3D
description: Role to deploy restic and setup backups. description: Role to deploy restic and setup backups.
license: MIT license: MIT
min_ansible_version: 2.8 min_ansible_version: 2.11
platforms: platforms:
- name: Debian - name: Debian
versions: versions:

View file

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

View file

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

View file

@ -1,7 +1,7 @@
--- ---
- name: install requirements - name: install requirements
become: true become: true
package: ansible.builtin.package:
name: name:
- jq - jq
- bsd-mailx - 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 when: submodules_versioncheck|bool
- name: deploy restic template - name: deploy restic template
template: ansible.builtin.template:
src: templates/restic_forget_snapshots.j2 src: templates/restic_forget_snapshots.j2
dest: /opt/restic-backup.sh dest: /opt/restic-backup.sh
group: "{{ restic_archiver__owner }}" group: "{{ restic_archiver__owner }}"
@ -11,10 +12,14 @@
mode: 0700 mode: 0700
become: true become: true
- include_tasks: logs.yml - name: setup logrotate
ansible.builtin.include_tasks: logs.yml
when: restic_archiver__log_output | bool 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 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 - name: Create directory for versionscheck
become: true become: true
ansible.builtin.file: ansible.builtin.file:
@ -32,11 +35,6 @@
when: when:
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool - 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 - name: write new version to remote disk
become: true become: true
ansible.builtin.copy: 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' playbook_version_path: 'role-restic_archiver_roles-ansible_github.com.version'