--- - name: Create users ansible.builtin.user: name: "{{ item['name'] }}" password: "{{ item['password'] }}" loop: "{{ users }}" - name: Define bashrc ansible.builtin.copy: dest: "{% if item['name'] == 'root' %}/root{% else %}/home/{{ item['name'] }}{% endif %}/.bashrc" src: files/users/bashrc owner: "{{ item['name'] }}" group: "{{ item['name'] }}" loop: "{{ users }}"