mirror of
https://github.com/borgbase/ansible-role-borgbackup.git
synced 2025-05-24 01:17:15 +02:00
37 lines
1.0 KiB
YAML
37 lines
1.0 KiB
YAML
---
|
|
- name: Setup backup environment
|
|
tags:
|
|
- install_backup
|
|
when:
|
|
- backup_create_local_user is not defined or backup_create_local_user
|
|
- borgbackup_user != "root"
|
|
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
|
|
register: user_info
|
|
|
|
- name: Save the user_info, we need them for the home_dir
|
|
ansible.builtin.set_fact:
|
|
backup_user_info: "{{ user_info }}"
|
|
|
|
- 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 /etc/borgmatic/{{ borgmatic_config_name }}"
|
|
...
|