--- - name: Ensure common-packages are installed become: true ansible.builtin.package: name: "{{ apt_packages_common }}" state: present - name: Ensure extra-packages are installed become: true ansible.builtin.package: name: "{{ apt_packages_extra }}" state: present when: apt_packages_extra is defined - name: Ensure vm-packages are installed become: true ansible.builtin.package: name: "{{ apt_packages_vm }}" state: present when: ansible_virtualization_role == 'guest' - name: Ensure physical-packages are installed become: true ansible.builtin.package: name: "{{ apt_packages_physical }}" state: present when: ansible_virtualization_role != 'guest' - name: Ensure packages are removed become: true ansible.builtin.package: name: "{{ apt_packages_absent }}" state: absent