Module: Chef::Knife::Cloud::BootstrapOptions

Defined in:
lib/chef/knife/cloud/chefbootstrap/bootstrap_options.rb

Overview

Ideally chef/knife/bootstap should expose this as module.

Class Method Summary collapse

Class Method Details

.included(includer) ⇒ Object



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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/chef/knife/cloud/chefbootstrap/bootstrap_options.rb', line 28

def self.included(includer)
  includer.class_eval do

    deps do
      require 'chef/json_compat'
      require 'tempfile'
      require 'highline'
      require 'net/ssh'
      require 'chef/knife/ssh'
      Chef::Knife::Ssh.load_deps
    end

    include Chef::Knife::WinrmBase

    option :ssh_user,
      :short => "-x USERNAME",
      :long => "--ssh-user USERNAME",
      :description => "The ssh username",
      :default => "root"

    option :ssh_password,
      :short => "-P PASSWORD",
      :long => "--ssh-password PASSWORD",
      :description => "The ssh password"

    option :ssh_port,
      :short => "-p PORT",
      :long => "--ssh-port PORT",
      :description => "The ssh port",
      :proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key },
      :default => "22"

    option :ssh_gateway,
      :long => "--ssh-gateway GATEWAY",
      :description => "The ssh gateway server. Any proxies configured in your ssh config are automatically used by default.",
      :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key }

    option :ssh_gateway_identity,
      :long => "--ssh-gateway-identity IDENTITY_FILE",
      :description => "The private key for ssh gateway server",
      :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway_identity] = key }

    option :forward_agent,
      :long => "--forward-agent",
      :description => "Enable SSH agent forwarding",
      :boolean => true

    option :identity_file,
      :short => "-i IDENTITY_FILE",
      :long => "--identity-file IDENTITY_FILE",
      :description => "The SSH identity file used for authentication"

    option :chef_node_name,
      :short => "-N NAME",
      :long => "--node-name NAME",
      :description => "The Chef node name for your new node"

    option :prerelease,
      :long => "--prerelease",
      :description => "Install the pre-release chef gems"

    option :bootstrap_version,
      :long => "--bootstrap-version VERSION",
      :description => "The version of Chef to install",
      :proc => lambda { |v| Chef::Config[:knife][:bootstrap_version] = v }

    option :bootstrap_proxy,
      :long => "--bootstrap-proxy PROXY_URL",
      :description => "The proxy server for the node being bootstrapped",
      :proc => Proc.new { |p| Chef::Config[:knife][:bootstrap_proxy] = p }

    option :bootstrap_no_proxy,
      :long => "--bootstrap-no-proxy [NO_PROXY_URL|NO_PROXY_IP]",
      :description => "Do not proxy locations for the node being bootstrapped; this option is used internally by Opscode",
      :proc => Proc.new { |np| Chef::Config[:knife][:bootstrap_no_proxy] = np }

    option :distro,
      :short => "-d DISTRO",
      :long => "--distro DISTRO",
      :description => "Bootstrap a distro using a template"

    option :use_sudo,
      :long => "--sudo",
      :description => "Execute the bootstrap via sudo",
      :boolean => true

    option :use_sudo_password,
      :long => "--use-sudo-password",
      :description => "Execute the bootstrap via sudo with password",
      :boolean => false

    option :template_file,
      :long => "--template-file TEMPLATE",
      :description => "Full path to location of template to use",
      :proc => Proc.new { |t| Chef::Config[:knife][:template_file] = t },
      :default => false

    option :run_list,
      :short => "-r RUN_LIST",
      :long => "--run-list RUN_LIST",
      :description => "Comma separated list of roles/recipes to apply",
      :proc => lambda { |o| o.split(/[\s,]+/) },
      :default => []

    option :first_boot_attributes,
      :short => "-j JSON_ATTRIBS",
      :long => "--json-attributes",
      :description => "A JSON string to be added to the first run of chef-client",
      :proc => lambda { |o| JSON.parse(o) },
      :default => {}

    option :host_key_verify,
      :long => "--[no-]host-key-verify",
      :description => "Verify host key, enabled by default.",
      :boolean => true,
      :default => true

    option :hint,
      :long => "--hint HINT_NAME[=HINT_FILE]",
      :description => "Specify Ohai Hint to be set on the bootstrap target.  Use multiple --hint options to specify multiple hints.",
      :proc => Proc.new { |h|
        Chef::Config[:knife][:hints] ||= Hash.new
        name, path = h.split("=")
        Chef::Config[:knife][:hints][name] = path ? JSON.parse(::File.read(path)) : Hash.new  }

    option :secret,
      :short => "-s SECRET",
      :long  => "--secret ",
      :description => "The secret key to use to encrypt data bag item values"

    option :secret_file,
      :long => "--secret-file SECRET_FILE",
      :description => "A file containing the secret key to use to encrypt data bag item values"

    option :bootstrap_url,
      :long        => "--bootstrap-url URL",
      :description => "URL to a custom installation script",
      :proc        => Proc.new { |u| Chef::Config[:knife][:bootstrap_url] = u }

    option :bootstrap_install_command,
      :long        => "--bootstrap-install-command COMMANDS",
      :description => "Custom command to install chef-client",
      :proc        => Proc.new { |ic| Chef::Config[:knife][:bootstrap_install_command] = ic }

    option :bootstrap_wget_options,
      :long        => "--bootstrap-wget-options OPTIONS",
      :description => "Add options to wget when installing chef-client",
      :proc        => Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo }

    option :bootstrap_curl_options,
      :long        => "--bootstrap-curl-options OPTIONS",
      :description => "Add options to curl when install chef-client",
      :proc        => Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co }

    option :auth_timeout,
      :long => "--auth-timeout MINUTES",
      :description => "The maximum time in minutes to wait to for authentication over the transport to the node to succeed. The default value is 25 minutes.",
      :default => 25
  end
end