Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Commit

Permalink
(#10804) add puppet manifest to install cfn client tools
Browse files Browse the repository at this point in the history
This module should be able to install its required
cfn client tools. The installation should be implemented
in puppet.

Adds cloudformation installation manifests.

Add dependency get_module_path function (this
will need to be removed if it gets accepted into
stdlib)

Add templates used to create cfn installation bashrc
and credential file.

add local aws-credentials to .gitignore

update README with new installation instructions
  • Loading branch information
Dan Bode committed Nov 14, 2011
1 parent df8fd23 commit a8715e4
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 522 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
AWSCloudFormation-*
bashrc_cfn
aws_credentials
31 changes: 22 additions & 9 deletions README
Expand Up @@ -3,14 +3,27 @@ a cluster of nodes with puppet enterprise installed.

## Installation

requires that the aws cloud formation developer tools are installed in order to launch
application stacks from the command line.
The amazon cloud formation client tools can be downloaded
using the cloudformation puppet class.

The steps below were based on the following getting started guide:
http://docs.amazonwebservices.com/AWSCloudFormation/latest/GettingStartedGuide/
The following example manifest can be found at examples/install.pp

* run install.sh to download the required client tools and generate the base bashrc_cnf
* update bashrc_cfn to ensure that it is using the correct paths for JAVA_HOME
* add your ec2 credentials to credential-file-path.template
* source bashrc_cnf to set up environment
* you may need to sync your clock before contacting the remote server
class { 'cloudformation':
aws_access_key => '< your key here >',
aws_secret_key => '< your secret key here >'
}

Add your aws credentials to the class declaration, ensure the cloudformation module
is in your module path, and use puppet to apply the installation manifest:

puppet apply examples/install.pp

This will install the client tools and create the file: bashrc_cfn

Configure your cfn client tools by sourcing this file:

source bash_rc

After you source this file, verify that your cfn tools work:

cfn-describe-stacks
2 changes: 0 additions & 2 deletions credential-file-path.template

This file was deleted.

4 changes: 4 additions & 0 deletions examples/install.pp
@@ -0,0 +1,4 @@
class { 'cloudformation':
aws_access_key => '< your key here >',
aws_secret_key => '< your secret key here >'
}
14 changes: 14 additions & 0 deletions lib/puppet/parser/functions/get_module_path.rb
@@ -0,0 +1,14 @@
module Puppet::Parser::Functions
newfunction(:get_module_path, :type =>:rvalue, :doc => <<-EOT
Given the name of a module as the argument, returns the path
of the module for the current environment.
EOT
) do |args|
raise(Puppet::ParseError, "get_module_name(): Wrong number of arguments, expects one") unless args.size == 1
if module_path = Puppet::Module.find(args[0], compiler.environment.to_s)
module_path.path
else
raise(Puppet::ParseError, "Could not find module #{args[0]} in environment #{compiler.environment}")
end
end
end
26 changes: 26 additions & 0 deletions manifests/init.pp
@@ -0,0 +1,26 @@
class cloudformation(
$aws_access_key,
$aws_secret_key,
$base_dir = get_module_path($module_name),
$aws_credential_file = "${base_dir}/aws_credentials",
$java_home = '/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home',
$cfn_version = '1.0.9'
) {
exec { 'download_cloudformation_client':
command => '/usr/bin/curl -o AWSCloudFormation-cli.zip https://s3.amazonaws.com/cloudformation-cli/AWSCloudFormation-cli.zip',
cwd => $base_dir,
creates => "${base_dir}/AWSCloudFormation-cli.zip",
}~>
exec { 'unzip_cfn_client':
command => '/usr/bin/unzip AWSCloudFormation-cli.zip',
cwd => $base_dir,
refreshonly => true,
creates => "${base_dir}/AWSCloudFormation-#{cfn_version}",
}
file { $aws_credential_file:
content => template('cloudformation/credential-file.erb'),
}
file { "${base_dir}/bashrc_cfn":
content => template('cloudformation/bashrc_cfn.erb'),
}
}

0 comments on commit a8715e4

Please sign in to comment.