--- - name: install packages become: yes ansible.builtin.package: name: - vim - ripgrep state: present - name: check if vundle is installed - folder become: yes stat: path: "{{ vim_vundle_path }}" register: folder_exists - name: Ensure repository is cloned locally. git: repo: "{{ vim_vundle_repo_url }}" dest: "{{ vim_vundle_path }}" depth: 1 register: repo_cloned - name: set owner recursive for repo file: path: "{{ vim_homedir }}" owner: mg group: mg recurse: yes when: repo_cloned.changed == true - name: Vundle - PluginInstall ansible.builtin.shell: yes | vim -c PluginInstall -c qall args: chdir: /home/mg when: - (folder_exists.stat.exists == False) and ("ansible_facts['distribution'] == 'Ubuntu'") become: yes become_user: mg