Many updates over time

This commit is contained in:
2026-02-24 17:57:35 -07:00
parent 6b36273324
commit 0132ed6a8f
68 changed files with 1409 additions and 197 deletions

View File

@@ -3,5 +3,5 @@
- name: Adding {{ user }} SSH key to {{ ssh_into }} users ~/.ssh/authorized_keys
authorized_key:
user: '{{ item }}'
key: "{{ lookup('file', user_path + '/keys/' + user + '.key.pub') }}"
key: "{{ lookup('file', '../roles/user/keys/' + user + '.key.pub') }}"
with_items: '{{ ssh_into }}'

View File

@@ -17,7 +17,7 @@
# Add OS specific sudo group
- set_fact:
user_groups: "{{ user_groups + [sudogroup] }}"
when: add_sudo|default(false)|bool
when: add_sudo == true
# Set root groups
- set_fact:
@@ -25,9 +25,14 @@
when: user == 'root'
# Home directory, use /home/username if undefined
# - set_fact:
# home: "/home/{{ user }}"
# when: (home is undefined or home == "")
- set_fact:
home: "/home/{{ user }}"
when: (home is undefined or home == "")
# Override home variable if user is root, only allow /root
- set_fact:
home: "/root"
when: (user == 'root')
# ------------------------------------------------------------------------------
@@ -43,10 +48,10 @@
- set_fact:
user_groups: ""
add_groups: ""
ssh_info: ""
ssh_into: ""
home: ""
add_sudo: no
create: yes
ssh_keys: no
ssh_authorize: yes
add_sudo: false
create: true
ssh_keys: false
ssh_authorize: true

View File

@@ -28,11 +28,11 @@
################################################################################
# Create user and groups
- include_tasks: create.yml
when: create|default(true)|bool
when: create == true
# Authorize user via SSH
- include_tasks: authorize.yml
when: ssh_into is defined and ssh_info != ""
when: ssh_into is defined and ssh_into != ""
# Debian modifications per user
- include_tasks: debian.yml

View File

@@ -7,7 +7,7 @@
create: yes
when: user != 'root'
- # Manjaro symlink ~/.vim
# Manjaro symlink ~/.vim
- name: Symlinking ~/.vim to /etc/vim
file:
src: /etc/vim

View File

@@ -15,19 +15,18 @@
user: '{{ user }}'
key: '{{ item }}'
with_file:
- '{{ user_path }}/keys/{{ user }}.key.pub'
when: ssh_authorize|default(true)|bool
- '../roles/user/keys/{{ user }}.key.pub'
when: ssh_authorize == true
# Create users public key
- name: Copying {{ user }} SSH public key
copy:
src: '{{ user_path }}/keys/{{ user }}.key.pub'
#dest: '{{ user_home }}/.ssh/id_rsa.pub'
src: '../roles/user/keys/{{ user }}.key.pub'
dest: '{{ "~" + user | expanduser }}/.ssh/id_rsa.pub'
owner: '{{ user }}'
group: '{{ user }}'
mode: '0644'
when: ssh_keys|default(false)|bool
when: ssh_keys == true
# Create users private key
- name: Copying {{ user }} SSH private key
@@ -37,4 +36,4 @@
owner: '{{ user }}'
group: '{{ user }}'
mode: '0600'
when: ssh_keys|default(false)|bool
when: ssh_keys == true

View File

@@ -16,5 +16,5 @@
password: "{{ users[user]['password'] }}"
update_password: always
home: "{{ home }}"
create_home: "{{ create_home | default('yes') }}"
shell: "{{ shell | default('/bin/bash') }}"
create_home: "{{ create_home }}"
shell: "{{ shell }}"