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 characters
| packer build packer.json 2>&1 | sudo tee output.txt | |
| tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt |
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 characters
| instance_id = "i-XXXXXX" | |
| server = AWS.servers.get(instance_id) | |
| server.block_device_mapping.each do |bd| | |
| begin | |
| puts "snapping #{bd["volumeId"]}" | |
| snap = AWS.snapshots.new(:volume_id => "#{bd['volumeId']}", :description => "#{instance_id}_#{bd['deviceName'].gsub("/","_")}-snap") | |
| snap.save | |
| puts "Got it!" | |
| rescue | |
| puts "snap failed for #{bd["volumeId"]}. Retrying" |
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 characters
| IO.popen('ant run') do |io| | |
| while (line = io.gets) do | |
| puts line | |
| end | |
| end |