Skip to content

Instantly share code, notes, and snippets.

@galenemery
Last active January 2, 2018 18:53
Show Gist options
  • Save galenemery/2b30968b0ed27dcf7d562568d4cd1125 to your computer and use it in GitHub Desktop.
Save galenemery/2b30968b0ed27dcf7d562568d4cd1125 to your computer and use it in GitHub Desktop.
Chef Provisioning AWS example
machine_batch do
1.upto(6) do |i|
machine "#{name}-prodweb#{i}" do
driver 'aws'
tag 'my-webserver'
machine_options :region => node["aws_deploy"]["region"],
:location => node["aws_deploy"]["location"],
:ssh_username => node["aws_deploy"]["ssh_username"],
:aws_tags => {"belongs_to" => name},
:convergence_options => {
:ssl_verify_mode => :verify_none,
:chef_version => node["aws_deploy"]["chef_version"]
},
:bootstrap_options =>{
:instance_type => node["aws_deploy"]["instance_type"],
:security_group_ids => [ "#{name}-ssh-sg", "#{name}-http-linux-sg" ],
:image_id => node["aws_deploy"]["linux"]["image_id"],
:key_name => node["aws_deploy"]["key_name"]
}
run_list ["role[ubuntu_base]", "recipe[apache]"]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment