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/ad12016d-c5e5-c89b-c225-1d6d99edaedc%40olstad.com.

Reply via email to