fixed user management, incl skel dir
This commit is contained in:
@@ -54,6 +54,13 @@
|
||||
- name: template jail
|
||||
shell: "bastille template {{ role_name }} services/{{ role_name }}"
|
||||
|
||||
|
||||
# FIXME: loop over files and check size somehow, or always copy? use file module?
|
||||
- name: copy skel files
|
||||
shell: cp -r /usr/local/bastille/templates/services/{{ role_name }}/usr/share/skel /usr/local/bastille/jails/{{ role_name }}/root/etc/
|
||||
args:
|
||||
creates: /usr/local/bastille/jails/{{ role_name }}/root/etc/skel
|
||||
|
||||
# The normal ansible user module can't be used here, because we're
|
||||
# talking about jail users here. I tried to patch the module to
|
||||
# support the -R flag (https://github.com/ansible/ansible/pull/84371)
|
||||
@@ -62,13 +69,7 @@
|
||||
#
|
||||
# So, instead I'm just using this simple script, which does the job as
|
||||
# well.
|
||||
- name: Create users
|
||||
- name: Manage users
|
||||
loop: "{{ users }}"
|
||||
shell: |
|
||||
if pw -V {{ item.rootdir }}/etc user show {{ item.name }} > /dev/null 2>&1; then \
|
||||
pw -V {{ item.rootdir }}/etc user mod {{ item.name }} -d /home/{{ item.name }} -G {{ item.groups }} -m -s {{ item.shell }}; \
|
||||
echo "user {{ item.name }} modified"; \
|
||||
else \
|
||||
pw -V {{ item.rootdir }}/etc user add {{ item.name }} -d /home/{{ item.name }} -G {{ item.groups }} -m -s {{ item.shell }}; \
|
||||
echo "user {{ item.name }} created"; \
|
||||
fi
|
||||
ansible.builtin.script: "bin/user.sh -u {{ item.name }} -g '{{ item.groups }}' -c {{ role_name }}-user -a {{ item.state }} -d /usr/local/bastille/jails/{{ role_name }}/root"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user