provision_ansible_user/tasks/create_user.yml
Bertrand Lanson 3f41dbee11
All checks were successful
test / Linting (push) Successful in 24s
test / Molecule tests (default, debian11) (push) Successful in 33s
test / Molecule tests (default, debian12) (push) Successful in 32s
test / Molecule tests (default, ubuntu2004) (push) Successful in 27s
test / Molecule tests (default, ubuntu2204) (push) Successful in 27s
test / Molecule tests (with_ssh_keys, debian11) (push) Successful in 35s
test / Molecule tests (with_ssh_keys, debian12) (push) Successful in 30s
test / Molecule tests (with_ssh_keys, ubuntu2004) (push) Successful in 30s
test / Molecule tests (with_ssh_keys, ubuntu2204) (push) Successful in 35s
feat: remove become frome role, fix #1
2023-12-03 18:08:11 +01:00

30 lines
939 B
YAML

---
# task/create_user file for provision_ansible_user
- name: "Create group {{ provision_ansible_user_group }}"
ansible.builtin.group:
name: "{{ provision_ansible_user_group }}"
state: present
system: "{{ provision_ansible_user_is_system }}"
- name: "Create user {{ provision_ansible_user_name }}"
ansible.builtin.user:
name: "{{ provision_ansible_user_name }}"
comment: "Ansible service user"
password: "{{ provision_ansible_user_password }}"
group: "{{ provision_ansible_user_group }}"
home: "{{ provision_ansible_user_home }}"
shell: "{{ provision_ansible_user_shell }}"
system: "{{ provision_ansible_user_is_system }}"
create_home: true
- name: "Add user to sudoers"
community.general.sudoers:
name: "{{ provision_ansible_user_name }}"
user: "{{ provision_ansible_user_name }}"
commands: ALL
nopassword: true
setenv: true
when: provision_ansible_user_sudoer