provision_management_user/tasks/create_user.yml

28 lines
974 B
YAML
Raw Permalink Normal View History

2023-05-10 15:07:10 +00:00
---
2023-05-10 15:15:57 +00:00
# task/create_user file for provision_management_user
- name: "Create group {{ provision_management_user_group }}"
2023-05-10 15:07:10 +00:00
ansible.builtin.group:
2023-05-10 15:15:57 +00:00
name: "{{ provision_management_user_group }}"
2023-05-10 15:07:10 +00:00
state: present
2023-05-10 15:15:57 +00:00
system: "{{ provision_management_user_is_system }}"
2023-05-10 15:07:10 +00:00
2023-05-10 15:15:57 +00:00
- name: "Create user {{ provision_management_user_name }}"
2023-05-10 15:07:10 +00:00
ansible.builtin.user:
2023-05-10 15:15:57 +00:00
name: "{{ provision_management_user_name }}"
2023-05-15 16:22:48 +00:00
comment: "Management user"
2023-05-10 15:15:57 +00:00
password: "{{ provision_management_user_password }}"
group: "{{ provision_management_user_group }}"
home: "{{ provision_management_user_home }}"
shell: "{{ provision_management_user_shell }}"
system: "{{ provision_management_user_is_system }}"
2023-05-10 15:07:10 +00:00
create_home: true
- name: "Add user to sudoers"
2023-06-10 20:42:37 +00:00
community.general.sudoers:
name: "{{ provision_management_user_name }}"
user: "{{ provision_management_user_name }}"
commands: ALL
nopassword: true
setenv: true
2023-05-10 15:15:57 +00:00
when: provision_management_user_sudoer