You've already forked ansible-role-unix-users
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4241502728 | |||
|
f5062ff179
|
|||
|
e4c12b9856
|
@@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5.0.1
|
- uses: actions/checkout@v5.0.1
|
||||||
- name: Run ansible-lint
|
- name: Run ansible-lint
|
||||||
uses: ansible/ansible-lint@v25.11.0
|
uses: ansible/ansible-lint@v25.11.1
|
||||||
with:
|
with:
|
||||||
args: "--config-file .ansible-lint"
|
args: "--config-file .ansible-lint"
|
||||||
setup_python: "true"
|
setup_python: "true"
|
||||||
|
|||||||
@@ -8,9 +8,33 @@
|
|||||||
when: unix_user.value.btrfs is defined and
|
when: unix_user.value.btrfs is defined and
|
||||||
unix_user.value.btrfs
|
unix_user.value.btrfs
|
||||||
block:
|
block:
|
||||||
|
- name: "Find btrfs device"
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: /bin/bash -c "findmnt -no SOURCE -T {{ user_user_home }} | sed 's/\[.*\]//'"
|
||||||
|
register: _unix_users_btrfs_device
|
||||||
|
failed_when: _unix_users_btrfs_device.rc != 0
|
||||||
|
changed_when: _unix_users_btrfs_device.rc == 0
|
||||||
|
|
||||||
|
- name: "Found btrfs device"
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: _unix_users_btrfs_device.stdout
|
||||||
|
when: _unix_users_debug is defined and
|
||||||
|
_unix_users_debug is true
|
||||||
|
|
||||||
|
- name: "Determine filesystem of device"
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
_unix_users_device_filesystem: "{{ ansible_facts['mounts'] | selectattr('device', 'equalto', _unix_users_btrfs_device.stdout) | map(attribute='fstype') | first }}"
|
||||||
|
|
||||||
|
- name: "Fail if device does not have a btrfs file system"
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: "Determined device {{ _unix_users_btrfs_device.stdout }} does not have a btrfs filesystem"
|
||||||
|
when: _unix_users_device_filesystem != 'btrfs'
|
||||||
|
|
||||||
- name: "Create btrfs volume for unix user: {{ unix_user.key }}"
|
- name: "Create btrfs volume for unix user: {{ unix_user.key }}"
|
||||||
community.general.btrfs_subvolume:
|
community.general.btrfs_subvolume:
|
||||||
|
filesystem_device: "{{ _unix_users_btrfs_device.stdout }}"
|
||||||
name: "{{ user_user_home }}"
|
name: "{{ user_user_home }}"
|
||||||
|
state: present
|
||||||
- name: "Adapt home dir permissions"
|
- name: "Adapt home dir permissions"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ user_user_home }}"
|
path: "{{ user_user_home }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user