mirror of
https://github.com/borgbase/ansible-role-borgbackup.git
synced 2024-11-24 19:06:35 +01:00
35 lines
965 B
YAML
35 lines
965 B
YAML
|
---
|
||
|
- name: Setup backup environment
|
||
|
when:
|
||
|
- backup_create_local_user is not defined or backup_create_local_user
|
||
|
- borg_user != "root"
|
||
|
block:
|
||
|
- name: Add local backup group
|
||
|
ansible.builtin.group:
|
||
|
name: "{{ borg_group }}"
|
||
|
state: present
|
||
|
|
||
|
- name: Add local backup user
|
||
|
ansible.builtin.user:
|
||
|
name: "{{ borg_user }}"
|
||
|
shell: "/bin/bash"
|
||
|
groups: "{{ borg_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: "{{ borg_user }}"
|
||
|
nopassword: true
|
||
|
commands:
|
||
|
- "/opt/borgmatic/bin/borg"
|
||
|
- "/usr/local/bin/borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
|
||
|
...
|