2023-03-15 09:58:12 +01:00
|
|
|
---
|
|
|
|
|
2023-03-23 10:30:52 +01:00
|
|
|
- when: not mash_playbook_uid and not mash_playbook_uid
|
|
|
|
block:
|
|
|
|
- name: Ensure mash group is created
|
|
|
|
ansible.builtin.group:
|
|
|
|
name: "{{ mash_playbook_user_groupname }}"
|
|
|
|
gid: "{{ omit if mash_playbook_gid is none else mash_playbook_gid }}"
|
|
|
|
state: present
|
|
|
|
register: mash_base_group_result
|
2023-03-15 09:58:12 +01:00
|
|
|
|
2023-03-23 10:30:52 +01:00
|
|
|
- name: Ensure mash user is created
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ mash_playbook_user_username }}"
|
|
|
|
uid: "{{ omit if mash_playbook_uid is none else mash_playbook_uid }}"
|
|
|
|
state: present
|
|
|
|
group: "{{ mash_playbook_user_groupname }}"
|
|
|
|
home: "{{ mash_playbook_base_path }}"
|
|
|
|
create_home: false
|
|
|
|
system: true
|
|
|
|
register: mash_base_user_result
|
2023-03-15 09:58:12 +01:00
|
|
|
|
2023-03-23 10:30:52 +01:00
|
|
|
- name: Initialize mash_playbook_uid and mash_playbook_gid
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
mash_playbook_uid: "{{ mash_base_user_result.uid }}"
|
|
|
|
mash_playbook_gid: "{{ mash_base_group_result.gid }}"
|