print public dns name of ec2 instance

10 views
Skip to first unread message

Benjamin Fernandis

unread,
Aug 29, 2016, 10:24:57 AM8/29/16
to Ansible Project
Hi,

I am testing to print ec2 instance public dns names by ansible.

- hosts:  localhost
  connection: local
  
  tasks:
    - name: get instance public dns name
      ec2_remote_facts:
        region: ap-southeast-2
        filters:
          instance-state-name:  running
      register: ec2

    - debug:  var=ec2.instances.public_dns_name

but i got " "ec2.instances.public_dns_name": "VARIABLE IS NOT DEFINED!" .

where i m doing mistake? 

Thanks
Benjo

    

Reply all
Reply to author
Forward
0 new messages