--- - name: Install vim packages ansible.builtin.apt: name: vim state: present - name: Copy configurations ansible.builtin.copy: src: files/vim/vimrc dest: "{{ '/root/.vimrc' if item['name'] == 'root' else '/home/' + item['name'] + '/.vimrc' }}" mode: '0644' loop: "{{ users }}" loop_control: label: "{{ item['name'] }}"