-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.yml
38 lines (32 loc) · 778 Bytes
/
main.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
---
- hosts: all
remote_user: root
tasks:
- name: Gruppe "ansible" anlegen
group:
name: ansible
gid: 20000
state: present
- name: Benutzer "ansible" anlegen
user:
name: ansible
createhome: yes
uid: 20000
group: ansible
state: present
- name: SSH-Key für Benutzer "ansible" kopieren
authorized_key:
user: ansible
key: "{{ lookup('file', './files/ansible_ssh_key.pub') }}"
key_options: 'no-port-forwarding'
- name: Installiere sudo
package:
name: sudo
state: present
- name: Sudoers-Eintrag für Benutzer "ansible" anlegen
copy:
dest: /etc/sudoers.d/ansible
content: 'ansible ALL= NOPASSWD: ALL'
owner: root
group: root
mode: 0500