feat: support btrfs subvolume for unix user's home dir
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
728c0484ad
commit
e24515d232
@ -23,6 +23,7 @@ unix_users: {}
|
|||||||
# private_keys:
|
# private_keys:
|
||||||
# - alice@alice-pc.ed25519.key
|
# - alice@alice-pc.ed25519.key
|
||||||
# home: /home/alice
|
# home: /home/alice
|
||||||
|
# btrfs: false
|
||||||
# shell: /bin/bash
|
# shell: /bin/bash
|
||||||
# group: alice
|
# group: alice
|
||||||
# groups: []
|
# groups: []
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
user_user_home: "{{ unix_user.value.home | default('/home/' + unix_user.key) }}"
|
user_user_home: "{{ unix_user.value.home | default('/home/' + unix_user.key) }}"
|
||||||
|
|
||||||
|
- name: "Create btrfs volume for unix user: {{ unix_user.key }}"
|
||||||
|
community.general.btrfs_subvolume:
|
||||||
|
name: "{{ user_user_home }}"
|
||||||
|
when: unix_user.value.btrfs
|
||||||
|
|
||||||
- name: "Create unix user without additional groups and uid: {{ unix_user.key }}"
|
- name: "Create unix user without additional groups and uid: {{ unix_user.key }}"
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ unix_user.key }}"
|
name: "{{ unix_user.key }}"
|
||||||
@ -56,6 +61,23 @@
|
|||||||
state: present
|
state: present
|
||||||
when: unix_user.value.groups is defined and unix_user.value.uid is not defined
|
when: unix_user.value.groups is defined and unix_user.value.uid is not defined
|
||||||
|
|
||||||
|
- name: "Adapt permissions and copy skel for unix user: {{ unix_user.key }}"
|
||||||
|
block:
|
||||||
|
- name: "Copy skel dir"
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: /etc/skel/
|
||||||
|
dest: "{{ user_user_home }}"
|
||||||
|
remote_src: true
|
||||||
|
owner: "{{ unix_user.key }}"
|
||||||
|
group: "{{ unix_user.value.group | default('users') }}"
|
||||||
|
- name: "Change permission unix users home dir: {{ unix_user.key }}"
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_user_home }}"
|
||||||
|
owner: "{{ unix_user.key }}"
|
||||||
|
group: "{{ unix_user.value.group | default('users') }}"
|
||||||
|
state: directory
|
||||||
|
when: unix_user.value.btrfs
|
||||||
|
|
||||||
- name: "Create .ssh directory for unix user: {{ unix_user.key }}"
|
- name: "Create .ssh directory for unix user: {{ unix_user.key }}"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ user_user_home }}/.ssh"
|
path: "{{ user_user_home }}/.ssh"
|
||||||
|
Loading…
Reference in New Issue
Block a user