is there any way to strip ansible output caused by with_items

Viewed 490

I'm new to ansible.

I have a problem when using ansible 'with_items'.

For example, the following code:

- assert:
    that:
      - ...
  with_items: "{{data_array_with_big_elements}}"

The running effect is

TASK [assert] ***************
ok: [10.250.15.160] => (item={......big.....body......here....}) => else_output.

What I want is to strip the item body to a short one.

Is there any idea to make it?

1 Answers

You can control the info displayed by loops using the loop_control attribute for your task.

- name: A looped task with controlled label
  command: /bin/true
  loop: "{{ some_list }}"
  loop_control:
    label: "Whatever you like, references to {{ item.some_attribute }} possible"

Check the above documentation link for more examples.

Related