-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_user_addssh.yml
45 lines (36 loc) · 1.01 KB
/
manage_user_addssh.yml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
---
- hosts: all
become: true
tasks:
- name: install updates in ubuntu
tags: always,ubuntu
apt:
update_cache: yes
upgrade: dist
changed_when: false # if any update is done on server then it will be not notified i.e changed=1
when: ansible_distribution == 'Ubuntu'
- name: install updates in ubuntu
tags: always,ubuntu
yum:
update_cache: yes
update_only: yes
changed_when: false # if any update is done on server>
when: ansible_distribution == 'Centos'
- name: create user ashwin
tags: user
user:
name: ashwin
group: root
- name: adding ssh key to connect without password
tags: ssh
authorized_key:
user: ashwin
key: "ssh-ed25519 7OMvcs17ntflXeaT7 root@kaal" # content of ~/.ssh/ed25519.pub
- name: adding user to sudoers
tags: sudo
copy:
src: file/sudoers_ashwin
dest: /etc/sudoers.d/ashwin
owner: root
group: root
mode: 0440