2023-03-22 21:40:01 +00:00
|
|
|
---
|
2023-03-22 21:41:01 +00:00
|
|
|
# task/create_user file for provision_ansible_user
|
2023-03-26 18:57:15 +00:00
|
|
|
- name: "Create group {{ provision_ansible_user_group }}"
|
2023-03-26 20:56:15 +00:00
|
|
|
ansible.builtin.group:
|
|
|
|
name: "{{ provision_ansible_user_group }}"
|
|
|
|
state: present
|
|
|
|
system: "{{ provision_ansible_user_is_system }}"
|
2023-12-03 17:08:11 +00:00
|
|
|
|
2023-03-26 20:56:15 +00:00
|
|
|
|
2023-03-23 22:17:24 +00:00
|
|
|
- name: "Create user {{ provision_ansible_user_name }}"
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ provision_ansible_user_name }}"
|
|
|
|
comment: "Ansible service user"
|
|
|
|
password: "{{ provision_ansible_user_password }}"
|
2023-03-26 20:56:15 +00:00
|
|
|
group: "{{ provision_ansible_user_group }}"
|
|
|
|
home: "{{ provision_ansible_user_home }}"
|
2023-03-23 22:17:24 +00:00
|
|
|
shell: "{{ provision_ansible_user_shell }}"
|
|
|
|
system: "{{ provision_ansible_user_is_system }}"
|
|
|
|
create_home: true
|
2023-12-03 17:08:11 +00:00
|
|
|
|
2023-03-24 22:40:02 +00:00
|
|
|
|
|
|
|
- name: "Add user to sudoers"
|
2023-06-10 20:44:47 +00:00
|
|
|
community.general.sudoers:
|
|
|
|
name: "{{ provision_ansible_user_name }}"
|
|
|
|
user: "{{ provision_ansible_user_name }}"
|
|
|
|
commands: ALL
|
|
|
|
nopassword: true
|
|
|
|
setenv: true
|
2023-03-25 23:00:42 +00:00
|
|
|
when: provision_ansible_user_sudoer
|