Merge branch 'ssh-key-fix' of evolix/EvoBSD into dev

This commit is contained in:
Tristan Pilat 2019-01-21 11:47:34 +01:00 committed by Gitea
commit f2bdfb8ff5
2 changed files with 30 additions and 25 deletions

View file

@ -1,26 +1,7 @@
--- ---
- name: Create admins accounts - name: Create user accounts
user: include: user.yml
state: present vars:
name: '{{ item.value.name }}' user: "{{ item.value }}"
uid: '{{ item.value.uid }}' with_dict: "{{ evolinux_users }}"
password: '{{ item.value.password_hash_openbsd }}' when: evolinux_users != {}
groups: wheel
shell: /bin/ksh
append: yes
with_dict:
"{{ evolix_users }}"
tags:
- admin
- name: Add admins ssh keys
lineinfile:
state: present
dest: '/home/{{ item.value.name }}/.ssh/authorized_keys'
line: '{{ item.value.ssh_keys }}'
create: yes
with_dict:
"{{ evolix_users }}"
tags:
- admin

View file

@ -0,0 +1,24 @@
---
- name: "User '{{ user.name }}' is present"
user:
state: present
name: '{{ user.name }}'
uid: '{{ user.uid }}'
password: '{{ user.password_hash_openbsd }}'
groups: wheel
shell: /bin/ksh
append: yes
tags:
- admin
- name: "SSH public keys for '{{ user.name }}' are present"
authorized_key:
user: "{{ user.name }}"
key: "{{ ssk_key }}"
state: present
with_items: "{{ user.ssh_keys }}"
loop_control:
loop_var: ssk_key
when: user.ssh_keys is defined
tags:
- admin