-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuseradd.yaml
32 lines (31 loc) · 1.22 KB
/
useradd.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
- name:
hosts: all
become: true
become_user: root
become_method: sudo
tasks:
# create users for us
# note user zyp.hein added to sudo group
# on many system you may need to use wheel
# user in sudo or wheel group can sudo
- user:
name: zyp.hein
comment: "Zay Yan Paing Hein(DC&Cloud)"
shell: /bin/bash
# groups: sudo
# append: yes
# generate_ssh_key: yes
# python -c 'import crypt,getpass; print crypt.crypt(getpass.getpass())'
password: $6$lUZtGcMx4w/WDdsu$YG.W4B7KoEQ6exlpqkVeXa9vwdFt/v3XLekz4TwhZpGJxKauBGMNRgfK/YLRWfw1iofB82T1ZMjwsWwJ9QYPl0
# ssh_key_type: ed25519
# upload ssh key
- authorized_key:
user: zyp.hein
state: present
manage_dir: yes
key: "{{ lookup('file', '/home/zawwin.min/LNX_Team/zayyanpaing.hein_ssh/AWS/zyp.hein_aws_id_rsa.pub') }}"
- name: Insert a line at the end of /etc/sudoers
lineinfile:
path: /etc/sudoers
line: "zyp.hein ALL=(ALL) NOPASSWD: ALL"