Hi Kai,

I had already tried it it gives me o/p as same as :
debug:
    msg: {{ instid }}

Both the o/ps are similar.

Now  i want the stdout_lines for each item as my desired o/p
something like:
e8ebc5a4-17f3-4b80-a935-03164211a804 TOMICS2
7865dvgsf-17f3-4b80-a935-03164211a804 TOMICS1
abc12345g-17f3-4b80-a935-03164211a804 TOMIAS2

On Tuesday, September 24, 2019 at 11:05:06 PM UTC+5:30, Kai Stian Olstad 
wrote:
>
> On 24.09.2019 19:06, Rakesh Parida wrote: 
> >   - name: Retrieve instance id from tenant 
> >     shell: openstack server list --all-projects --project "{{ 
> > tenantid.stdout }}" | awk 'NR > 3 { print $2, $4 }' | grep -i "{{ item 
> }}" 
> >     with_items: "{{ hostvars[groups['nodes'][0]]['fact'] }}" 
> >     register: instid 
> > 
> >      - name: Debug Instance id and Tennat id 
> >        delegate_to: localhost 
> >        debug: 
> >          msg: 
> >           - "Tenant ID:" 
> >           - "{{ tenantid.stdout }}" 
> >           - "===============================" 
> >           - "Instance ID of the VMs in TOM 
> >           - "{{ instid.stdout_lines}}" 
>
> When using register with with_items/loop you'll have instid.results which 
> is a list where each item contain the output for each command. 
>
> When you get errors like this always run a 
>   - debug: var=instid 
>
> -- 
> Kai Stian Olstad 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/50aaf43a-f2b3-48a0-bff5-651e8fd78b67%40googlegroups.com.

Reply via email to