From 4c2377e18876950c27cd63b76dab3970803e744e Mon Sep 17 00:00:00 2001 From: Frank Dornheim <524257+conloos@users.noreply.github.com> Date: Fri, 10 Mar 2023 17:58:30 +0100 Subject: [PATCH] Switch created to perform the backup as root or service account. If a service account is to be used, it will be created. --- tasks/02_user_management.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tasks/02_user_management.yml diff --git a/tasks/02_user_management.yml b/tasks/02_user_management.yml new file mode 100644 index 0000000..c3679fd --- /dev/null +++ b/tasks/02_user_management.yml @@ -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 +...