<p>if you do something like:</p>

<pre><code>- name: Launch instance
  ec2:
  register: data_struct
</code></pre>

<p>You can then output all the values returned by doing this below the above code:</p>

<pre><code>- name: print all returned values
  debug:
    msg: "{{ data_struct }}"
</code></pre>

CC BY-SA 4.0
2019-01-09T09:23:26.180Z
2019-01-09T09:23:26.180Z
Zohaib Amanzai
<p>From <a href="https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#return-values" rel="noreferrer">Ansible's official doc</a></p>

<blockquote>
  <p>Ansible modules normally return a data structure that can be registered into a variable, or seen directly when output by the ansible program</p>
</blockquote>

<p>and</p>

<blockquote>
  <p>Ansible modules normally return a data structure that can be registered into a variable, or seen directly when output by the ansible program</p>
</blockquote>

<p>However, the <a href="https://docs.ansible.com/ansible/latest/modules/ec2_module.html" rel="noreferrer">document on aws_ec2 module</a> </p>

<ol>
<li>Doesn't document return values</li>
<li>Has this example, which seems like it actually has some specific return values</li>
</ol>



<pre><code># Stripped version

# Launch instances, runs some tasks
# and then terminate them

- name: Create a sandbox instance
  ... # hosts, vars...
  tasks:
    - name: Launch instance
      ec2:
      ... # ec2 module specs
      register: ec2 #This seems to be one of the specific return structure by this module

    - name: Wait for SSH to come up
      ... # some module
      with_items: "{{ ec2.instances }}" # This is where the registered return value is used
</code></pre>

<p>Question: How to see all possible return values of a module, even without documentation</p>

<ansible>
Ansible how to know what return value is provided by a specific module
Tran Triet
# Ansible how to know what return value is provided by a specific module

(Asked by: username_0 on 2019-01-09)

From Ansible's official doc

Ansible modules normally return a data structure that can be registered into a variable, or seen directly when output by the ansible program

and

Ansible modules normally return a data structure that can be registered into a variable, or seen directly when output by the ansible program

However, the document on aws_ec2 module 

Doesn't document return values
Has this example, which seems like it actually has some specific return values

# Stripped version

# Launch instances, runs some tasks
# and then terminate them

- name: Create a sandbox instance
  ... # hosts, vars...
  tasks:
    - name: Launch instance
      ec2:
      ... # ec2 module specs
      register: ec2 #This seems to be one of the specific return structure by this module

    - name: Wait for SSH to come up
      ... # some module
      with_items: "{{ ec2.instances }}" # This is where the registered return value is used

Question: How to see all possible return values of a module, even without documentation

**Tags:** ansible


---

## 1 answers

### Answer by username_1 on 2019-01-09. Score: 10 | Accepted answer

if you do something like:
- name: Launch instance
  ec2:
  register: data_struct

You can then output all the values returned by doing this below the above code:
- name: print all returned values
  debug:
    msg: "{{ data_struct }}"


---

