Created
July 31, 2012 17:05
-
-
Save glarizza/3218523 to your computer and use it in GitHub Desktop.
Cloud Provisioner in Ruby
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
| require 'puppet' | |
| require 'puppet/face' | |
| arguments = { 'image' => 'ami-30fe7300', | |
| 'keyname' => 'Your_Key', | |
| 'type' => 't1.micro', | |
| 'region' => 'us-west-2' } | |
| list_args = { 'region' => 'us-west-2' } | |
| install_args = { 'login' => 'ec2-user', | |
| 'keyfile' => 'Your_Key.pem', | |
| 'install_script' => 'puppet-enterprise-http', | |
| 'installer_payload' => 'http://pm.puppetlabs.com/puppet-enterprise/2.0/puppet-enterprise-2.0-el-6-x86_64.tar.gz', | |
| 'installer_answers' => '/Users/gary/Desktop/Writeups/pe-answers-agent.txt' } | |
| # Create an Instance | |
| ec2_ip = Puppet::Face[:node_aws, :current].create(arguments) | |
| # List instances | |
| instances = Puppet::Face[:node_aws, :current].list(list_args) | |
| # Install Puppet | |
| install_node = Puppet::Face[:node, :current].install(ec2_ip, install_args) | |
| # Terminate an instance | |
| Puppet::Face[:node_aws, :current].terminate(ec2_ip, list_args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment