-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers.yml
27 lines (20 loc) · 847 Bytes
/
users.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
---
- name: Create user steve.
user: name=steve comment="Steve Tjoa" groups=admin,sudo shell=/bin/bash
- name: Remove insecure authorized key for vagrant.
file: path=/home/vagrant/.ssh/authorized_keys state=absent
- name: Add authorized key for steve and vagrant.
authorized_key: user={{ item }} key="{{ lookup('file', '/vagrant/id_rsa.pub') }}"
with_items:
- steve
- vagrant
- name: Remove steve's password.
command: passwd -d steve
- name: Remove vagrant password.
command: passwd -d vagrant
- name: Disallow root SSH access.
lineinfile: dest=/etc/ssh/sshd_config regexp="^PermitRootLogin" line="PermitRootLogin no"
notify: restart sshd
- name: Disallow password authentication.
lineinfile: dest=/etc/ssh/sshd_config regexp="^PasswordAuthentication" line="PasswordAuthentication no"
notify: restart sshd