39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
|
---
|
||
|
# tasks file for sysadmin
|
||
|
bloc:
|
||
|
|
||
|
- name: add user
|
||
|
user:
|
||
|
name: "{{ item.username }}"
|
||
|
uid: "{{ item.uid }}" # Why ask for a specific UID?
|
||
|
home: "{{ item.home }}"
|
||
|
group: "{{ item.username }}"
|
||
|
groups: "{{ item.groups }}"
|
||
|
state: present
|
||
|
|
||
|
|
||
|
- name: create ssh dir
|
||
|
file:
|
||
|
path: "{{ item.home }}/.ssh"
|
||
|
owner: "{{item.username}}"
|
||
|
mode: '0700'
|
||
|
state: directory
|
||
|
|
||
|
- name: add git ssh server in authorized_keys
|
||
|
ansible.builtin.known_hosts:
|
||
|
path: "{{item.home}}/.ssh/known_hosts"
|
||
|
name: "[git.jean-cloud.net]:22529"
|
||
|
key: "[git.jean-cloud.net]:22529,[51.255.33.248]:22529 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBD5wYpMhqZ1DDgVKyX5tutlM8BHu2evhVsi2/5mpuqVYZU8LjI9oTVs6rxIV7FlgtHlPDpad5pTIk//bJxFGdA="
|
||
|
# key: "{{ lookup('ansible.builtin.file', 'files/git_key.pub') }}"
|
||
|
state: present
|
||
|
|
||
|
|
||
|
- name: Set authorized key
|
||
|
ansible.posix.authorized_key:
|
||
|
user: "{{ item.username }}"
|
||
|
state: present
|
||
|
key: "{{ item.public_ssh_key }}"
|
||
|
|
||
|
with_items: "{{sysadmin}}"
|
||
|
|