Hi,

check out the label directive for loop_control:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#loop-control

Cheers,
Felix



On Mon, 28 Jan 2019 07:54:39 -0800 (PST)
[email protected] wrote:

> Hey all-
> 
> I'm using stat and with_items to check proper ownership of various
> files. Is there any way to reduce the volume of output (i.e.,
> eliminate everything in red, below)?
> 
> rowagn@localhost:~/data-platform/oracle/ansible/db12r2$ cat test.yml 
> ---
> - hosts: localhost
>   tasks:
>   - name: Stat filesystems
>     stat: path="{{ item }}"
>     with_items:
>       - /dev
>       - /home
>     register: filesystems_stat
> 
>   - name: Confirming ownership of filesystems
>     assert:
>       that: "{{ item.stat.pw_name == 'root' }}"
>     with_items: "{{ filesystems_stat.results }}"
>     loop_control:
>       label: "{{ item.item }}"
> 
>   - name: Stat filesystem no with_items
>     stat: path="/dev"
>     register: dev_stat
> 
>   - name: Confirming ownership of dev
>     assert:
>       that: "{{ dev_stat.stat.pw_name == 'root' }}"
> 
> rowagn@localhost:~/data-platform/oracle/ansible/db12r2$
> ansible-playbook -i "localhost," -c local test.yml 
> 
> PLAY [localhost] 
> ***************************************************************
> 
> TASK [setup] 
> *******************************************************************
> ok: [localhost]
> 
> TASK [Stat filesystems] 
> ********************************************************
> ok: [localhost] => (item=/dev)
> ok: [localhost] => (item=/home)
> 
> TASK [Confirming ownership of filesystems] 
> *************************************
> ok: [localhost] => (item=/dev) => {
>     "changed": false, 
>     "item": {
>         "changed": false, 
>         "invocation": {
> [...]

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20190128201139.31da177c%40rovaniemi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to