ansible-role-borg-backup/tasks/02_create_backup_user_and_group.yml
2023-03-05 14:03:06 +01:00

38 lines
1.2 KiB
YAML

---
- name: Setup backup environment
tags:
- install_backup
when:
- install_backup is not defined or install_backup
- backup_create_local_user is not defined or backup_create_local_user
block:
- name: Add local backup group
ansible.builtin.group:
name: "{{ borgbackup_group }}"
state: present
- name: Add local backup user
ansible.builtin.user:
name: "{{ borgbackup_user }}"
shell: "/bin/bash"
groups: "{{ borgbackup_group }}"
comment: "Backup User Account"
append: true
- name: Add sudo users
community.general.sudoers:
name: "backup"
state: present
user: "{{ borgbackup_user }}"
nopassword: true
commands:
- "/opt/borgmatic/bin/borg"
- "/usr/local/bin/borgmatic -C -p -c /etc/borgmatic/{{ borgmatic_config_name }}"
- "/usr/local/bin/borgmatic -k -c /etc/borgmatic/{{ borgmatic_config_name }}"
- "/usr/local/bin/borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
- name: Install Links to borg and borgmatic
ansible.builtin.include_tasks:
file: noauto_create_links_and_install_helperscripts.yml
...