-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuser.yml
More file actions
50 lines (43 loc) · 1.08 KB
/
user.yml
File metadata and controls
50 lines (43 loc) · 1.08 KB
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
46
47
48
49
50
---
- hosts: server
become: true
vars:
admins:
- sven
- lars
- tiuti
admin_group: '{% if ansible_os_family == "RedHat"%}wheel{% else %}sudo{% endif %}'
tasks:
- name: install epel
package:
name: epel-release
when: ansible_os_family == "RedHat"
- name: install base tools
package:
name:
- vim
- zsh
- htop
- iotop
- mc
- name: install for RedHat only
dnf:
name: policycoreutils-python-utils
- name: create admin users
user:
name: '{{ item }}'
groups: '{{ admin_group }}'
append: true
loop: '{{ admins }}'
- name: set up admin authorized keys
authorized_key:
user: '{{ item }}'
state: present
key: "{{ lookup('file', 'pub-keys/{{ item }}.pub') }}"
loop: '{{ admins }}'
- name: allow to sudo without a password
copy:
dest: /etc/sudoers.d/password-less-sudo
mode: 0600
content: '%{{ admin_group }} ALL=(ALL) NOPASSWD: ALL'
force: yes