Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/dotfiles
Path: blob/master/roles/users/tasks/main.yml
245 views
1
---
2
- name: Create Admin User
3
user:
4
name: aos
5
password: "{{ aos_password | password_hash('sha512', password_salt) }}"
6
groups: sudo
7
create_home: yes
8
shell: /bin/bash
9
10
- name: Create IRC user
11
user:
12
name: irssi
13
password: "{{ aos_password | password_hash('sha512', password_salt) }}"
14
create_home: yes
15
shell: /bin/bash
16
17
- name: Create IRC directory
18
file:
19
path: '~/.irssi'
20
state: directory
21
mode: '0755'
22
tags: [ 'never', 'irssi' ]
23
24
- name: Add IRC files
25
copy:
26
src: "{{ item }}"
27
dest: "~/.irssi/{{ item | basename }}"
28
with_fileglob: 'irssi/*'
29
tags: [ 'never', 'irssi' ]
30
31
- name: Add Authorized Keys
32
authorized_key:
33
user: "{{ item }}"
34
key: "{{ shared_publickey }}"
35
state: present
36
with_items:
37
- aos
38
- irssi
39
40
- name: Disable Password Authentication and Root Login
41
lineinfile:
42
dest: /etc/ssh/sshd_config
43
regexp: "^{{ item.config | regex_escape() }}"
44
line: "{{ item.config }} {{ item.value }}"
45
with_items:
46
- { config: 'PermitRootLogin', value: 'no' }
47
- { config: 'PasswordAuthentication', value: 'no' }
48
notify:
49
- restart ssh
50
51