--- - name: copy user ssh keys copy: src: keys dest: "/usr/local/bastille/" # 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) # but it makes no sense. Every single function needs to be patched so # that it works for jails. # # So, instead I'm just using this simple script, which does the job as # well. - name: Manage users loop: "{{ users }}" ansible.builtin.script: "bin/user.sh -u {{ item.name }} -g '{{ item.groups }}' -c {{ role_name }}-user -a {{ item.state }} -d /usr/local/bastille/jails/pubnix/root"