add group role, rename default group

This commit is contained in:
2024-12-09 19:03:48 +01:00
parent f92f2f2fad
commit 411f71a7ff
6 changed files with 80 additions and 160 deletions

View File

@@ -65,17 +65,17 @@
# args:
# creates: /usr/local/bastille/jails/{{ role_name }}/root/etc/skel
# these will later be used by bin/user.sh (see below) to be installed
# into the user homes
- name: copy user ssh keys
copy:
src: keys
dest: "/usr/local/bastille/"
- name: create user group
shell: |
pw -R {{ defaults.jailbase }}/{{ role_name }}/root group show {{ defaults.group }} ||\
pw -R {{ defaults.jailbase }}/{{ role_name }}/root group add {{ defaults.group }}
# create our own group[s]
- name: Manage groups
loop: "{{ jailgroups }}"
ansible.builtin.script: "bin/group.sh -g {{ item.name }} -a {{ item.state }} -d /usr/local/bastille/jails/pubnix/root"
# 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
@@ -86,6 +86,6 @@
# So, instead I'm just using this simple script, which does the job as
# well.
- name: Manage users
loop: "{{ users }}"
loop: "{{ jailusers }}"
ansible.builtin.script: "bin/user.sh -u {{ item.name }} -g '{{ item.groups | default(defaults.group) }}' -c {{ role_name }}-user -a {{ item.state }} -d {{ defaults.jailbase }}/{{ role_name }}/root"