amazon ec2 - Store ansible output to variable -


i want use ansible information aws ec2 instance. looking it's instance-id. going use loop through template. can't seem instance-id. here have far:

--- - name: including variables   include_vars:     file: linux.yml  - name: gathering ec2 facts   ec2_remote_facts:     aws_access_key: "{{ access_key }}"     aws_secret_key: "{{ secret_key }}"     region: us-east-1     filters:         "tag:name": "{{ ansible_hostname }}"   register: instanceid - debug: var=instanceid.instances.id 

i know incorrect when run get:

"instanceid.instances.id": "variable not defined!"

can tell me of way return instanceid?

if first time, gradually... understand what's inside. like:

- debug: var=instanceid # see raw result , find out `instances` there  - debug: var=instanceid.instances # see `instanses` is, , see list  - debug: var=instanceid.instances[0] # see first element of list , see it's properties  - debug: var=instanceid.instances[0].id # see instance id 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -