Switch created to perform the backup as root or service account. If a service account is to be used, it will be created.

This commit is contained in:
Frank Dornheim 2023-03-10 17:58:30 +01:00
parent 1a3131cefc
commit 4c2377e188

View File

@ -0,0 +1,20 @@
---
# So in different positions in that role we need the user home
# Since we cannot be sure that this FSH is compatible we will determine it.
- name: Get home if borgbackup_user == "root"
when: borgbackup_user == "root"
ansible.builtin.user:
name: "{{ borgbackup_user }}"
state: present
register: user_info
changed_when: false
check_mode: true # Important, otherwise user will be created
- name: Save the user_info, we need them for the home_dir
ansible.builtin.set_fact:
backup_user_info: "{{ user_info }}"
- name: Create User if borgbackup_user != "root"
ansible.builtin.include_tasks:
file: noauto_create_backup_user_and_group.yml
...