Feat: add public key to ssh to user
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
---
|
||||
# tasks file for user
|
||||
# Create user
|
||||
- name: users -- Ensure wheel group exists
|
||||
group:
|
||||
name: wheel
|
||||
@@ -16,6 +17,16 @@
|
||||
state: present
|
||||
system: "{{ user.system | default('no') }}"
|
||||
|
||||
#
|
||||
- name: ssh -- Add public key
|
||||
authorized_key:
|
||||
user: "{{ user.username }}"
|
||||
key: "{{ lookup('file', item.keyfile) }}"
|
||||
state: present
|
||||
with_items: "{{ user.public_key }}"
|
||||
when: user.public_key
|
||||
|
||||
# Dotfiles
|
||||
- name: Install for arch
|
||||
import_tasks: arch.yml
|
||||
when: ansible_os_family == "Archlinux"
|
||||
@@ -28,18 +39,15 @@
|
||||
ansible.builtin.git:
|
||||
repo: "{{ user.config.giturl }}"
|
||||
dest: "/home/{{ user.username }}/.dotfiles"
|
||||
become: yes
|
||||
|
||||
- name: user owns its dotfiles
|
||||
ansible.builtin.file:
|
||||
path: "/home/{{ user.username }}/.dotfiles"
|
||||
owner: "{{ user.username }}"
|
||||
become: yes
|
||||
|
||||
- name: stow configs
|
||||
ansible.builtin.command:
|
||||
cmd: stow {{ item }}
|
||||
chdir: "/home/{{ user.username }}/.dotfiles"
|
||||
with_items: "{{ user.config.stowing }}"
|
||||
become: yes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user