Hello All,

I have an ansible script that I am writing to use meta data from an aws ec2 
instance. I want to create and image of a list og servers from my inventory 
file them launch each one, then perform a function then terminate the 
instances.I am currently stuck on trying to get the subnet portion of the 
meta data as I need to perform two commands.
1) get the mac address 
2) get the subnet 

But I am not able to successfully get the subnet id

---
- hosts: dev
 become: yes
 #connection: local
# gather_facts: no
 

  tasks:
#  - name: Install boto3 and botocore with pip3 module
#    pip:
#      name: 
#      - boto3
#      - botocore
#      executable: pip3.6

  - name: Get Instance info
   command: "wget -q -O - http:
//169.254.169.254/latest/meta-data/instance-id"
   register: instanceid

  - debug: msg="instance id is {{instanceid.stdout }} "

  - name: Get subnetID
   shell: >
      INTERFACE="curl --silent 
http://169.254.169.254/latest/meta-data/network/interfaces/macs/";
      curl --silent 
http://169.254.169.254/latest/meta-data/network/interfaces/macs/$INTERFACE
/subnet-id
   
   args:
     executable: /bin/bash
   register: subnet_id
 #  environment:
 #    INTERFACE: "curl --silent 
http://169.254.169.254/latest/meta-data/network/interfaces/macs/";


I am currently getting an error:

  msg: |-
    subnet_id is <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
    <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
     <head>
      <title>404 - Not Found</title>
     </head>
     <body>
      <h1>404 - Not Found</h1>
     </body>
    </html>

Can anyone please assist?

Thank you 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/05517824-ddc4-4d2e-930f-a8d1d9638f45%40googlegroups.com.

Reply via email to