Class: Cloudster::ChefClient
- Inherits:
-
Object
- Object
- Cloudster::ChefClient
- Defined in:
- lib/cloudster/chef_client.rb
Overview
UserData for Chef Client bootstrap
Instance Method Summary collapse
-
#add_to(ec2) ⇒ Object
Merges the required CloudFormation template for installing the Chef Client to the template of the EC2 instance.
-
#initialize(options = {}) ⇒ ChefClient
constructor
Initialize an ChefClient configuration.
Constructor Details
#initialize(options = {}) ⇒ ChefClient
Initialize an ChefClient configuration
Notes
options parameter must include values for :validation_key, :server_url and :node_name
Examples
chef_client = Cloudster::ChefClient.new(
:validation_key => 'asd3e33880889098asdnmnnasd8900890a8sdmasdjna9s880808asdnmnasd90-a',
:server_url => 'http://10.50.60.70:4000',
:node_name => 'project.environment.appserver_1',
:validation_client_name => 'chef-validator',
:interval => 1800
)
Parameters
-
options<~Hash> -
* :validation_key: String containing the key used for validating this client with the server. This can be taken from the chef-server validation.pem file. Mandatory field * :server_url: String containing the fully qualified domain name of the chef-server. Mandatory field * :node_name: String containing the name for the chef node. It has to be unique across all nodes in the particular chef client-server ecosystem. Mandatory field * :interval: Integer containing the interval(in seconds) between chef-client runs. Default value : 1800 seconds * :validation_client_name: String containing the name of the validation client. "ORGNAME-validator" if using hosted chef server. Default: 'chef-validator'
26 27 28 29 30 31 32 33 |
# File 'lib/cloudster/chef_client.rb', line 26 def initialize( = {}) (, [:validation_key, :server_url, :node_name]) @validation_key = [:validation_key] @server_url = [:server_url] @node_name = [:node_name] @interval = [:interval] || 1800 @validation_client_name = [:validation_client_name] || 'chef-validator' end |
Instance Method Details
#add_to(ec2) ⇒ Object
Merges the required CloudFormation template for installing the Chef Client to the template of the EC2 instance
Examples
chef_client = Cloudster::ChefClient.new(
:validation_key => 'asd3e33880889098asdnmnnasd8900890a8sdmasdjna9s880808asdnmnasd90-a',
:server_url => 'http://10.50.60.70:4000',
:node_name => 'project.environment.appserver_1'
)
ec2 = Cloudster::Ec2.new(
:name => 'AppServer',
:key_name => 'mykey',
:image_id => 'ami_image_id',
:instance_type => 't1.micro'
)
chef_client.add_to ec2
Parameters
-
instance of EC2
55 56 57 58 59 60 |
# File 'lib/cloudster/chef_client.rb', line 55 def add_to(ec2) ec2_template = ec2.template @instance_name = ec2.name chef_client_template = template ec2.template.inner_merge(chef_client_template) end |