homeserver/roles/mgrote_rsync/tasks/user.yml

31 lines
747 B
YAML
Raw Normal View History

2024-10-28 18:17:23 +01:00
---
- name: ensure group exists
become: true
ansible.builtin.group:
2024-10-28 18:27:43 +01:00
name: "{{ rsync_mirror_user_group }}"
2024-10-28 18:17:23 +01:00
state: present
when:
2024-10-28 18:27:43 +01:00
- rsync_mirror_user_group is defined
- rsync_mirror_user is defined
2024-10-28 18:17:23 +01:00
- name: ensure user exists
become: true
ansible.builtin.user:
2024-10-28 18:27:43 +01:00
name: "{{ rsync_mirror_user }}"
group: "{{ rsync_mirror_user_group }}"
2024-10-28 18:17:23 +01:00
create_home: true
when:
2024-10-28 18:27:43 +01:00
- rsync_mirror_user_group is defined
- rsync_mirror_user is defined
2024-10-28 18:24:29 +01:00
- name: Ensure user is added to sudoers
become: true
community.general.sudoers:
2024-10-28 18:27:43 +01:00
name: "users-sudo-{{ rsync_mirror_user }}"
2024-10-28 18:24:29 +01:00
state: present
2024-10-28 18:27:43 +01:00
user: "{{ rsync_mirror_user }}"
2024-10-28 18:24:29 +01:00
commands: ALL
nopassword: true
when:
2024-10-28 18:27:43 +01:00
- rsync_mirror_syncoid_destination_host