Feat: set fact for user creation
This commit is contained in:
parent
200412cfd0
commit
af2903ab74
@ -1,12 +1,16 @@
|
||||
---
|
||||
# tasks file for user
|
||||
- name: set facts
|
||||
set_fact:
|
||||
username: "{{ user.username }}"
|
||||
|
||||
# Create user
|
||||
- name: users -- Ensure wheel group exists
|
||||
group:
|
||||
name: wheel
|
||||
state: present
|
||||
|
||||
- name: create users
|
||||
- name: "{{ username }}: create user "
|
||||
ansible.builtin.user:
|
||||
name: "{{ user.username }}"
|
||||
update_password: on_create
|
||||
@ -19,7 +23,7 @@
|
||||
create_home: true
|
||||
|
||||
#
|
||||
- name: ssh -- Add public key
|
||||
- name: "{{ username }}: Add public key"
|
||||
authorized_key:
|
||||
user: "{{ user.username }}"
|
||||
key: "{{ lookup('file', item.keyfile) }}"
|
||||
@ -29,10 +33,10 @@
|
||||
when: false
|
||||
|
||||
# Dotfiles
|
||||
- name: set dotfiles
|
||||
- name: "{{ username }}: set dotfiles"
|
||||
import_tasks: dotfiles.yml
|
||||
|
||||
- name: gtk_settings
|
||||
- name: "{{ username }}: gtk_settings"
|
||||
dconf:
|
||||
key: "{{ item.key }}"
|
||||
value: "{{ item.value }}"
|
||||
@ -42,7 +46,7 @@
|
||||
become_user: "{{ user.username }}"
|
||||
|
||||
|
||||
- name: user owns its create_home
|
||||
- name: "{{ username }}: user owns its create_home"
|
||||
file:
|
||||
path: "/home/{{ user.username }}/.dotfiles"
|
||||
owner: "{{ user.username }}"
|
||||
|
Loading…
Reference in New Issue
Block a user