Hi, I have playbook to retrieve the Instance id of Openstack nodes.Now everything works fine but the resgitered value for instid.stdout_lines gets an undefined error. *The error was: 'dict object' has no attribute 'stdout_lines'* .. but when i debug the complete registered variable instid i see stdout_lines. but why its failing when i debug it using instid.stdout_lines
"item": "TOMCS2", "rc": 0, "start": "2019-09-24 09:15:45.801051", "stderr": "", "stderr_lines": [], "stdout": "e8ebc5a4-17f3-4b80-a935-03164211a804 TOMICS2", *"stdout_lines": [* * "e8ebc5a4-17f3-4b80-a935-03164211a804 TOMCS2"* - hosts: nodes[0] gather_facts: false tasks: - name: Collect Hostnames set_fact: host_lists: "{{ hostvars[inventory_hostname]['groups']['nodes'] }}" - name: Create Hostname as per the Name in openstack names set_fact: fact: '{{ (["TOM"] * host_lists|length)|zip(host_lists)|map("join")|list}}' - name: Debug the required list debug: msg: "{{ fact }}" - hosts: 127.0.0.1 gather_facts: false tasks: - name: Retrieve tenantID shell: openstack project list | awk '/ TOM / { print $2 }' register: tenantid - 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}}" -- 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/cc57f323-5d44-4b9b-97e9-ccc1e9f19542%40googlegroups.com.