--- - name: Vim is installed and up to date (rhel) yum: name: "{{ item }}" state: latest loop: - vim - wget - git when: ansible_distribution == 'CentOS' or ansible_distribution == 'RedHat' or ansible_distribution == 'AlmaLinux' - name: Vim is installed and up to date (debian) apt: name: "{{ item }}" state: present update_cache: yes loop: - vim - wget - git when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - name: Vim is installed and up to date (arch) community.general.pacman: name: "{{ item }}" state: present loop: - vim - wget - git when: ansible_distribution == 'Archlinux'