-
-
Save mlehner616/ae99de4966e579afe76b to your computer and use it in GitHub Desktop.
Revisions
-
mlehner616 revised this gist
Feb 10, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ require 'facter' require 'json' if Facter.value("ec2_instance_id") != nil instance_id = Facter.value("ec2_instance_id") region = Facter.value("ec2_placement_availability_zone")[0..-2] tags = Facter::Util::Resolution.exec("aws ec2 describe-tags --region #{region} --filters \"Name=resource-id,Values=#{instance_id}\" --query 'Tags[*].{value:Value,key:Key}'") parsed_tags = JSON.parse(tags) parsed_tags.each do |tag| -
rafaelfelix revised this gist
Jul 8, 2013 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,10 @@ require 'facter' require 'json' if Facter.value("ec2_instance_id") != nil instance_id = Facter.value("ec2_instance_id") region = Facter.value("ec2_placement_availability_zone")[0..-2] tags = Facter::Util::Resolution.exec("aws ec2 describe-tags --filters \"name=resource-id,values=#{instance_id}\" --region #{region} | jq '[.Tags[] | {key: .Key, value: .Value}]'") parsed_tags = JSON.parse(tags) parsed_tags.each do |tag| -
rafaelfelix revised this gist
Jul 5, 2013 . 1 changed file with 9 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,13 @@ require 'facter' require 'json' if Facter.value("ec2_instance_id") =! nil instance_id = Facter.value("ec2_instance_id") tags = Facter::Util::Resolution.exec("aws ec2 describe-tags --filters \"name=resource-id,values=#{instance_id}\" --region sa-east-1 | jq '[.Tags[] | {key: .Key, value: .Value}]'") parsed_tags = JSON.parse(tags) parsed_tags.each do |tag| fact = "ec2_tag_#{tag["key"]}" Facter.add(fact) { setcode { tag["value"] } } end end -
rafaelfelix revised this gist
Jul 5, 2013 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,11 @@ require 'facter' require 'json' instance_id = Facter.value("ec2_instance_id") tags = Facter::Util::Resolution.exec("aws ec2 describe-tags --filters \"name=resource-id,values=#{instance_id}\" --region sa-east-1 | jq '[.Tags[] | {key: .Key, value: .Value}]'") parsed_tags = JSON.parse(tags) parsed_tags.each do |tag| fact = "ec2_tag_#{tag["key"]}" Facter.add(fact) { setcode { tag["value"] } } end -
drohr created this gist
Feb 27, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ require 'facter' instance_id = Facter::Util::Resolution.exec("ec2-metadata -i | awk '{print $2}'") tags = Facter::Util::Resolution.exec("ec2-describe-tags --region eu-west-1 --filter \"resource-id=#{instance_id}\" | cut -f 4-") tags.scan(/(\w+)\s+(\w+)/) do |key, value| fact = "ec2_tag_#{key}" Facter.add(fact) { setcode { value } } end