官术网_书友最值得收藏!

Configuring your local environment

By now, you should have access to a Chef server of some sort; here, we will be using the hosted Chef service, but the work (aside from configuring your knife.rb file) will remain the same across self-managed and hosted Chef instances. In order to follow along with the examples, you will need to configure your workstation with an appropriate knife.rb file and certificates. These files can be downloaded from the hosted Chef console and modified as needed.

Additionally, you will need to have installed knife through the chef gem and have the knife-ec2 gem installed in order to interact with EC2. If you prefer to use a different provider, then you can refer to the previous chapter on how to provision cloud hosts with this provider when you get to the provisioning step.

In our example, using hosted Chef and EC2, our knife.rb file will contain content similar to the following code:

current_dir = File.dirname(__FILE__)
log_level     :info
log_location  STDOUT
node_name     "myorg"
client_key    "#{current_dir}/myorg.pem"
validation_client_name "myorg-validator"
validation_key  "#{current_dir}/myorg-validator.pem"
chef_server_url "https://api.opscode.com/organizations/myorg"
cache_type      'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path   ["#{current_dir}/../cookbooks"]
knife[:aws_access_key_id] = "YOUR AWS ACCESS KEY"
knife[:aws_secret_access_key] = "YOUR AWS SECRET KEY"
knife[:region] = "AWS REGION"

Again, the base files can be downloaded from the hosted Chef console, or if you are using a self-managed Chef installation, this can be found on your Chef server.

主站蜘蛛池模板: 蓬莱市| 囊谦县| 太原市| 遵义市| 蓬安县| 吕梁市| 九江市| 兖州市| 丽江市| 曲周县| 乐亭县| 永仁县| 彩票| 霍林郭勒市| 大足县| 正宁县| 吉隆县| 丹凤县| 麟游县| 黄石市| 疏勒县| 云南省| 辰溪县| 榆社县| 余庆县| 乌拉特后旗| 九龙县| 尚志市| 白河县| 农安县| 安新县| 定陶县| 青河县| 呼伦贝尔市| 娄底市| 淮阳县| 吉隆县| 嘉义市| 九江县| 阳信县| 灵川县|