2017-06-16 80 views
-1

我有循環一些任務,當我運行它們,我得到的輸出是這樣的:更改ansible輸出

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)) 

有沒有辦法將其更改爲

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

無需外部utils的?

回答

1

loop_control

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

再次感謝,康斯坦丁! – HeroFromEarth