homeserver/playbooks/on-off/remove_old_restic_config.yml

72 lines
1.7 KiB
YAML
Raw Normal View History

---
- hosts: all
become: yes
tasks:
- name: remove /etc/restic
become: yes
ansible.builtin.file:
path: /etc/restic
state: absent
- name: ensure user exists
become: true
ansible.builtin.user:
name: restic
state: absent
- name: add user to sudoers
become: true
ansible.builtin.blockinfile:
path: /etc/sudoers
state: absent
block: |
restic ALL=(ALL) NOPASSWD:ALL
validate: '/usr/sbin/visudo -cf %s'
backup: yes
marker_begin: restic-sudoers BEGIN
marker_end: restic-sudoers END
- name: copy smb_password.txt
become: yes
ansible.builtin.file:
dest: "/etc/restic/smb_password.txt"
state: absent
- name: copy restic_backup.sh
become: yes
ansible.builtin.file:
state: absent
dest: "/usr/local/bin/restic_backup.sh"
- name: remove exclude.txt
become: yes
ansible.builtin.file:
path: "/etc/restic/exclude.txt"
state: absent
- name: copy password.txt
become: yes
ansible.builtin.file:
state: absent
dest: "/etc/restic/password.txt"
- name: remove restic cronjob
become: yes
ansible.builtin.cron:
name: restic
state: absent
job: "/usr/local/bin/restic_backup.sh"
minute: "{{ 59|random(seed=inventory_hostname) }}"
- name: remove restic log
become: true
ansible.builtin.file:
path: /var/log/restic.log
state: absent
- name: copy logrotate config
become: yes
ansible.builtin.file:
state: absent
dest: /etc/logrotate.d/restic