--- - hosts: localhost tasks: - name: Set roles ansible.builtin.set_fact: roles: "{{ ansible_run_tags != ['all'] and ansible_run_tags or default_roles | difference(exclude_roles | default([])) }}" tags: - always - name: Display roles ansible.builtin.debug: "var=roles" tags: - always - name: Run roles ansible.builtin.include_role: name: "{{ item }}" apply: tags: - "{{ item }}" with_items: "{{ roles }}" tags: - always