Created
August 19, 2011 21:57
Revisions
-
ccaum created this gist
Aug 19, 2011 .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,39 @@ #!/usr/bin/env ruby require 'rubygems' require 'puppet' require 'puppet/face' require 'puppet/cloudpack' options = { :image => 'ami-3d76b754', :type => 'm1.large', :region => 'us-east-1', :keypair => 'ccaum_rsa', :keyfile => '/root/.ec2/ccaum_rsa.pem', :login => 'ec2-user' } #Fire up instance from AMI =begin server = Puppet::Face[:node, '0.0.1'].create :image => options[:image], :type => options[:type], :region => options[:region], :keypair => options[:keypair] Puppet::Face[:certificate, '0.0.1'].sign(certname) =end server = 'ec2-107-20-67-187.compute-1.amazonaws.com' #Run Puppet on Instance command = String.new unless options[:login] == 'root' command << '/usr/bin/sudo ' end command << 'mkdir /tmp/testme' exit_code = Puppet::CloudPack.ssh_remote_execute(server, options[:login], command, options[:keyfile]) raise "Failed to run puppet on instance #{server}" unless exit_code == 0 puts "Successfully ran puppet on instance #{server}"