I'd like to compare notes and find out who else is doing this. I'm trying to
expose some EC2 data to Cfengine even on hosts that may not have EC2 tools
installed. This is a module that I've come up with so far:
#!/bin/bash
meta_data="ami-id instance-id public-ipv4 security-groups
placement/availability-zone"
for i in `echo ${meta_data}`
do
prefix=`echo ${i} | sed -e 's/\-/_/g' -e 's/\//_/g'`
r=`/usr/bin/curl -s http://instance-data.ec2.internal/latest/meta-data/${i}`
if [ $? -eq "0" ]
then
suffix=`echo ${r} | sed -e 's/\-/_/g' -e 's/\//_/g' -e 's/\./_/g'`
echo +ec2_${prefix}_${suffix}
else
echo +ec2_${prefix}_detect_failed
fi
done
I thought I'd put it up for comment.
Best,
--Bruce
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine