-
-
Save anonymous/e9d9d0ad6cd2c4d72d0f to your computer and use it in GitHub Desktop.
This file contains 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
data.each do |k,v| | |
v.each do |instance| | |
cmd = "chef exec knife ec2 server create \ | |
--ssh-user 'ec2-user' \ | |
--identity-file ~/.ssh/#{instance[:pem]}.pem \ | |
--secret-file ~/.ssh/#{instance[:sf]}.pem \ | |
--bootstrap-version 11.18.6\ | |
--availability-zone '#{instance[:region]}#{instance[:az]}' \ | |
--flavor '#{instance[:inst_type]}' \ | |
--ebs-size '#{instance[:ebs]}' \ | |
--image 'ami-#{instance[:ami]}' \ | |
--ssh-key '#{instance[:pem]}' \ | |
--region '#{instance[:region]}' \ | |
--iam-profile '#{instance[:iam_role]}' \ | |
--security-group-ids '#{instance[:sg]}' \ | |
--subnet 'subnet-#{instance[:subnet]}' \ | |
--tags 'Name=ae1#{instance[:az]}#{;k.to_s.chars.first}l#{instance[:apps]}#{i.to_s},Apps=#{instance[:apps]},App Owner=#{instance[:owner]},Environment=#{k.to_s.up$ | |
--environment '#{k.to_s.downcase}' \ | |
--run-list 'role[#{Roles.runList_roles[i-1]}]'" | |
IO.popen cmd do |f| | |
until f.eof? | |
puts f.gets | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment