"New" attribute to supress the task trace before a failing task

Is there a way for “failed but expected” assertions, e.g. ones that cannot be handled by role validation to fail less noisily than usual failures. For example, with

- name: If a limit has been specified, ensure it includes localhost  # for cooldown
  run_once: true
  when: ansible_limit is defined
  assert:
    that: ('localhost' in ansible_limit | split(','))
    fail_msg: If a limit is specified with --limit [-l], it must include localhost
    quiet: true

Which is because my playbook has a final play that has localhost to gather up results from all of the target hosts from the previous plays into a number of files.
If I specify -l host1,host2 rather than -l host1,host2,localhost (an easy mistake to make), I get

TASK [role_name : If a limit has been specified, ensure it includes localhost] *************************************************************************************************************************************
Saturday 19 September 2026  11:07:43 +0100 (0:00:00.077)       0:00:00.092 **** 
[ERROR]: Task failed: Action failed: If a limit is specified with --limit [-l], it must include localhost
Origin: <path>:<line>:<column>

1 ---
2 - name: If a limit has been specified, ensure it includes localhost  # for cooldown
    ^ column 3

fatal: [host1]: FAILED! => 
    assertion: ('localhost' in ansible_limit | split(','))
    changed: false
    evaluated_to: false
    msg: If a limit is specified with --limit [-l], it must include localhost

It would be good if there could be attribute on the task, similar to no_log, perhaps fail_quiet, that would give:

TASK [role_name : If a limit has been specified, ensure it includes localhost] *************************************************************************************************************************************
Saturday 19 September 2026  11:07:43 +0100 (0:00:00.077)       0:00:00.092 **** 
[ERROR]: Task failed: Action failed: If a limit is specified with --limit [-l], it must include localhost
Origin: <path>:<line>:<column>

fatal: [host1]: FAILED! => 
    assertion: ('localhost' in ansible_limit | split(','))
    changed: false
    evaluated_to: false
    msg: If a limit is specified with --limit [-l], it must include localhost

or even

TASK [role_name : If a limit has been specified, ensure it includes localhost] *************************************************************************************************************************************
Saturday 19 September 2026  11:07:43 +0100 (0:00:00.077)       0:00:00.092 **** 
[ERROR]: Task failed: Action failed: If a limit is specified with --limit [-l], it must include localhost
Origin: <path>:<line>:<column>

Although it would be most appropriate to assert I assume this would be much easier to implement as an attribute on any task (like no_log) rather than one on assert (like quiet)

Of course, another way of doing this would be good.

FWIW, --limit selects hosts in a playbook. It does not select available inventory. For example, the complete inventory

> cat hosts/localhost 
localhost ansible_connection=local

> cat hosts/www
[www]
www_01
www_02
www_03

is available

> ansible-inventory -i hosts --graph
@all:
  |--@ungrouped:
  |  |--localhost
  |--@www:
  |  |--www_01
  |  |--www_02
  |  |--www_03

As a result, localhost is available to delegate to

- hosts: all
  gather_facts: false
  tasks:
    - set_fact:
        log: "Running on {{ inventory_hostname }} ..."

    - name: Gather results from target hosts
      delegate_to: localhost
      run_once: true
      block:
        - debug:
            msg: |
              {% for h in ansible_limit | split(',') %}
              {{ h }}: {{ hostvars[h]['log'] | d('UNDEF') }}
              {% endfor %}

For example,

> ansible-playbook -i hosts -l www_01,www_02 pb.yml 

PLAY [all] **********************************************************************************

TASK [set_fact] *****************************************************************************
ok: [www_01]
ok: [www_02]

TASK [debug] ********************************************************************************
ok: [www_01 -> localhost] => 
    msg: |-
        www_01: Running on www_01 ...
        www_02: Running on www_02 ...

PLAY RECAP **********************************************************************************
www_01                     : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
www_02                     : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 

Ah, it never occurred to me that I could make localhost explicit in the inventory. I’ve always used it implicitly. That solves the problem for this case, Thanks.

I still have other cases where a quieter assert might be useful.