Add 'create_user_cody.yaml'
This commit is contained in:
parent
8cb45eaae9
commit
7f5eef08f5
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
- name: Create user 'cody' with sudo permissions
|
||||
hosts: all
|
||||
become: true
|
||||
vars:
|
||||
user_name: "cody"
|
||||
user_password: "temppass1"
|
||||
tasks:
|
||||
- name: Create user 'cody'
|
||||
user:
|
||||
name: "{{ user_name }}"
|
||||
password: "{{ user_password | password_hash('sha512') }}"
|
||||
shell: /bin/bash
|
||||
createhome: yes
|
||||
|
||||
- name: Add 'cody' to sudo group
|
||||
lineinfile:
|
||||
path: /etc/sudoers
|
||||
line: "{{ user_name }} ALL=(ALL) ALL"
|
||||
validate: 'visudo -cf %s'
|
||||
state: present
|
||||
backup: yes
|
Loading…
Reference in New Issue