-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathknife.rb
67 lines (59 loc) · 2.47 KB
/
knife.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Configuration file for Chef's `knife` command
# =============================================
#
# The configuration expects you to have following pre-requisites:
#
# * Your Chef user present in ~/.chef/USERNAME.pem
#
# * The `CHEF_ORGANIZATION` environment variable containing the Chef organization exported
#
# * The `CHEF_ORGANIZATION_KEY` environment variable containing full path to organization
# [validation key](https://manage.opscode.com/organizations) exported
#
# * For starting instances in Amazon AWS, the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
# environment variables exported
#
# You can export environment variables eg. in your `~/.bashrc` or `~/.profile` files:
#
# export CHEF_ORGANIZATION='my-organization'
# export CHEF_ORGANIZATION_KEY='/path/to/my-organization-validator.pem'
#
# Make sure to reload the file when you change it:
#
# source ~/.bashrc
# source ~/.profile
#
def check_environment_variable(name, message=nil)
unless ENV[name]
puts "[!] You have to export the #{name} environment variable", (message || '')
exit!(1)
end
end
check_environment_variable 'HOME'
check_environment_variable 'USER'
check_environment_variable 'CHEF_ORGANIZATION'
check_environment_variable 'CHEF_ORGANIZATION_KEY'
check_environment_variable 'NGINX_USER'
check_environment_variable 'NGINX_PASSWORD'
check_environment_variable 'MONIT_USER'
check_environment_variable 'MONIT_PASSWORD'
check_environment_variable 'PICKWICK_API_URL'
check_environment_variable 'PICKWICK_API_TOKEN'
check_environment_variable 'PICKWICK_API_RW_TOKEN'
check_environment_variable 'PICKWICK_ADMIN_USERNAME'
check_environment_variable 'PICKWICK_ADMIN_PASSWORD'
check_environment_variable 'SIDEKIQ_USERNAME'
check_environment_variable 'SIDEKIQ_PASSWORD'
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name ENV['USER']
client_key "#{ENV['HOME']}/.chef/#{ENV['USER']}.pem"
validation_client_name "#{ENV['CHEF_ORGANIZATION']}-validator"
validation_key ENV['CHEF_ORGANIZATION_KEY']
chef_server_url "https://api.opscode.com/organizations/#{ENV['CHEF_ORGANIZATION']}"
cache_options :path => "#{current_dir}/.chef/tmp/checksums"
cookbook_path ["#{current_dir}/site-cookbooks", "#{current_dir}/cookbooks"]
check_environment_variable 'DIGITAL_OCEAN_ACCESS_TOKEN'
knife[:digital_ocean_access_token] = ENV['DIGITAL_OCEAN_ACCESS_TOKEN']
knife[:bootstrap_version] = '11.6.2'