Hi Rob, > Hey Felix - can you elaborate? I'm already using: > > loop_control: > label: "{{ item.item }}" > > As shown in my post. It doesn't quench the output of the items. Am > I missing something?
sorry, I guess I misunderstood something. The problem is that assert always enables verbose output, so you cannot get rid of item completely. What you can do is tidy up item so only the important things are in there. You could try something like loop: | {{ filesystems_stat.results | map(attribute='item') | zip(filesystems_stat.results | map(attribute='stat.pw_name')) | list }} Then you should be able to access item.item via item.0 and item.stat.pw_name via item.1, i.e. the rest of the task would be assert: that: item.1 == 'root' loop_control: label: "{{ item.0 }}" (I haven't tested this, so it might contain bugs, but in principle that should work. Note that the zip filter is Ansible specific, while the map and list filters are generic Jinja2.) (Also: with_items does the same as loop if you give it a simple list; you should switch to loop in such cases, and stop using with_items if not explicitly needed.) Cheers, Felix > > Rob > > On Monday, January 28, 2019 at 2:11:57 PM UTC-5, Felix Fontein wrote: > > > > 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) > > rjwagn...@gmail.com <javascript:> 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": { > > > [...] > > > -- Felix Fontein -- fe...@fontein.de -- https://felix.fontein.de/ -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20190130214324.6f725e36%40rovaniemi. For more options, visit https://groups.google.com/d/optout.