-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssh-key.yaml
31 lines (30 loc) · 1.22 KB
/
ssh-key.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
---
- hosts: fc_advance_printing
become: true
become_user: root
become_method: sudo
tasks:
# create users for us
# note user vivek 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$KyaHNM8wOd0j5nbR$eZLWF8VGzXtRBkEI2Gk1BL/4ZqwbVwDPImnbTbza0zT89yuB6FPu6jT3zuvaW78xcfO1JMRCtBMxBsd/8KwIr1
# ssh_key_type: ed25519
# upload ssh key
- authorized_key:
user: zyp.hein
state: present
manage_dir: yes
key: "{{ lookup('file', '/home/zawwin.min/Flexcube-CBS-DEV-Prod-C_S-Team/Keys/zyp.hein_id_rsa.pub') }}"
- name: Insert a line at the end of /etc/sudoers
lineinfile:
path: /etc/sudoers
line: "zyp.hein ALL=(ALL) NOPASSWD: ALL"