HeroFromEarth
HeroFromEarth

Reputation: 93

Change ansible output

I have some tasks with loops and when I run them I get something like this in output:

TASK [mytask : Create files] **********************************************
changed: [localhost] => (item=(censored due to no_log))
changed: [localhost] => (item=(censored due to no_log))
changed: [localhost] => (item=(censored due to no_log))

Is there a way to change it to

TASK [mytask : Create files] **********************************************
changed: [localhost] => (create file1)
changed: [localhost] => (create file2)
changed: [localhost] => (create file3)

without external utils?

Upvotes: 0

Views: 1191

Answers (1)

Konstantin Suvorov
Konstantin Suvorov

Reputation: 68239

There's loop_control:

- name: create files
  file: 
    path: "/tmp/tmp_{{ item }}"
    state: touch
  with_items: [1,2,3]
  loop_control:
    label: "create file {{ item }}"

Upvotes: 2

Related Questions