2019-02-26 03:49:51 +00:00
|
|
|
---
|
|
|
|
|
2020-04-19 04:26:48 +00:00
|
|
|
- name: creating user {{ create_username }} in sudo group (Debian/Ubuntu)
|
2019-02-26 03:49:51 +00:00
|
|
|
user:
|
2020-04-19 04:26:48 +00:00
|
|
|
name: "{{ create_username }}"
|
|
|
|
password: "{{ create_pwgen | password_hash('sha512') }}"
|
2019-02-26 03:49:51 +00:00
|
|
|
state: present
|
|
|
|
shell: /bin/bash
|
|
|
|
groups: sudo
|
|
|
|
append: yes
|
|
|
|
generate_ssh_key: yes
|
|
|
|
ssh_key_bits: 2048
|
|
|
|
ssh_key_file: .ssh/id_rsa
|
|
|
|
update_password: on_create
|
|
|
|
register: user_created
|
|
|
|
|
|
|
|
- name: enable nopasswd sudo (Debian/Ubuntu)
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/sudoers
|
|
|
|
regexp: '^%sudo'
|
|
|
|
line: "%sudo ALL=(ALL:ALL) NOPASSWD:ALL"
|
|
|
|
state: present
|
|
|
|
validate: 'visudo -cf %s'
|