--- - block: - name: Installing vim package: name: "{{ vim_package_name }}" state: present - name: Creating configuration directory file: state: directory dest: /etc/vim owner: root group: root mode: 0755 - name: Configure vim template: src: etc/vim/vimrc.local.j2 dest: /etc/vim/vimrc.local owner: root group: root mode: 0644 - name: Fix default vim (debian) lineinfile: dest: /etc/vim/vimrc regexp: '^\"\s*let\sg\:skip_defaults_vim.*$' line: 'let g:skip_defaults_vim = 1' when: ansible_os_family == "Debian" - name: Source local vimrc (redhat) blockinfile: dest: /etc/vimrc marker: "\" {mark} ANSIBLE MANAGED BLOCK" block: | if filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.local endif when: ansible_os_family == "RedHat" become: True become_user: root