Browse Source

enable adding normal users

pull/1/head
L3D 2 years ago
parent
commit
ad817e76e2
2 changed files with 25 additions and 0 deletions
  1. +6
    -0
      README.md
  2. +19
    -0
      tasks/main.yml

+ 6
- 0
README.md View File

@@ -9,10 +9,16 @@ Ansible Rolle für die SSH Keys
```bash
/host_vars/gw01.ffbsee.net
--------------------------
# all admins of this host
admins:
- mart
- l3d

# all non-admins of this host
users:
- franz

# all ssh keys for all admins and users
admin_ssh_keys: 'admin_ssh_keys'
```
```

+ 19
- 0
tasks/main.yml View File

@@ -32,6 +32,25 @@
with_items: '{{ admins }}'
become: yes

- name: Add individual group
group:
name: '{{ item}}'
state: present
become: yes
with_items: '{{ users }}'
when: users is defined


- name: Add non admin users
become: yes
user:
name: '{{ item }}'
shell: '/bin/bash'
groups: '{{ item }}'
append: yes
with_items: '{{ users }}'
when: users is defined

- name: Create .ssh directory for all admin users
file:
path: '/home/{{ item }}/.ssh'

Loading…
Cancel
Save