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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
# File 'lib/chef/knife/winops_bootstrap_windows_base.rb', line 36
def self.included(includer)
includer.class_eval do
deps do
require 'readline'
require 'chef/json_compat'
end
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 => Proc.new { |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 :bootstrap_debug,
:long => "--bootstrap-debug",
:description => "Verbose bootstrap output",
:proc => Proc.new { |bv| Chef::Config[:knife][:bootstrap_debug] = bv }
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_run_command,
:long => "--bootstrap_run_command COMMANDS",
:description => "Custom command to run (chef-client)",
:proc => Proc.new { |rc| Chef::Config[:knife][:bootstrap_run_command] = rc }
option :bootstrap_tail_file,
:long => "--bootstrap_tail_file FILENAME",
:description => "Custom (log)file to tail on console",
:proc => Proc.new { |tf| Chef::Config[:knife][:bootstrap_tail_file] = tf }
option :distro,
:short => "-d DISTRO",
:long => "--distro DISTRO",
:description => "Bootstrap a distro using a template. [DEPRECATED] Use -t / --bootstrap-template option instead.",
:proc => Proc.new { |v|
Chef::Log.warn("[DEPRECATED] -d / --distro option is deprecated. Use --bootstrap-template option instead.")
v
}
option :bootstrap_template,
:short => "-t TEMPLATE",
:long => "--bootstrap-template TEMPLATE",
:description => "Bootstrap Chef using a built-in or custom template. Set to the full path of an erb template or use one of the built-in templates."
option :template_file,
:long => "--template-file TEMPLATE",
:description => "Full path to location of template to use. [DEPRECATED] Use -t / --bootstrap-template option instead.",
:proc => Proc.new { |v|
Chef::Log.warn("[DEPRECATED] --template-file option is deprecated. Use --bootstrap-template option instead.")
v
}
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(",") },
:default => []
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 ? Chef::JSONCompat.parse(::File.read(path)) : Hash.new
}
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 => nil
option :first_boot_attributes_from_file,
:long => "--json-attribute-file FILE",
:description => "A JSON file to be used to the first run of chef-client",
:proc => lambda { |o| Chef::JSONCompat.parse(File.read(o)) },
:default => nil
option :encrypted_data_bag_secret,
:short => "-s SECRET",
:long => "--secret ",
:description => "The secret key to use to decrypt data bag item values. Will be rendered on the node at c:/chef/encrypted_data_bag_secret and set in the rendered client config.",
:default => false
option :encrypted_data_bag_secret_file,
:long => "--secret-file SECRET_FILE",
:description => "A file containing the secret key to use to encrypt data bag item values. Will be rendered on the node at c:/chef/encrypted_data_bag_secret and set in the rendered client config."
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 2 minutes.",
:default => 2
option :node_ssl_verify_mode,
:long => "--node-ssl-verify-mode [peer|none]",
:description => "Whether or not to verify the SSL cert for all HTTPS requests.",
:proc => Proc.new { |v|
valid_values = ["none", "peer"]
unless valid_values.include?(v)
raise "Invalid value '#{v}' for --node-ssl-verify-mode. Valid values are: #{valid_values.join(", ")}"
end
v
}
option :node_verify_api_cert,
:long => "--[no-]node-verify-api-cert",
:description => "Verify the SSL cert for HTTPS requests to the Chef server API.",
:boolean => true
option :msi_url,
:short => "-u URL",
:long => "--msi-url URL",
:description => "Location of the Chef Client MSI. The default templates will prefer to download from this location. The MSI will be downloaded from chef.io if not provided.",
:default => ''
option :install_as_service,
:long => "--install-as-service",
:description => "Install chef-client as a Windows service",
:default => false
option :bootstrap_vault_file,
:long => '--bootstrap-vault-file VAULT_FILE',
:description => 'A JSON file with a list of vault(s) and item(s) to be updated'
option :bootstrap_vault_json,
:long => '--bootstrap-vault-json VAULT_JSON',
:description => 'A JSON string with the vault(s) and item(s) to be updated'
option :bootstrap_vault_item,
:long => '--bootstrap-vault-item VAULT_ITEM',
:description => 'A single vault and item to update as "vault:item"',
:proc => Proc.new { |i|
(vault, item) = i.split(/:/)
Chef::Config[:knife][:bootstrap_vault_item] ||= {}
Chef::Config[:knife][:bootstrap_vault_item][vault] ||= []
Chef::Config[:knife][:bootstrap_vault_item][vault].push(item)
Chef::Config[:knife][:bootstrap_vault_item]
}
option :policy_name,
:long => "--policy-name POLICY_NAME",
:description => "Policyfile name to use (--policy-group must also be given)",
:default => nil
option :policy_group,
:long => "--policy-group POLICY_GROUP",
:description => "Policy group name to use (--policy-name must also be given)",
:default => nil
option :tags,
:long => "--tags TAGS",
:description => "Comma separated list of tags to apply to the node",
:proc => lambda { |o| o.split(/[\s,]+/) },
:default => []
option :chef_server,
:long => "--[no-]chef_server",
:description => "Register node in chef server. Or not.",
:boolean => true,
:default => true
option :payload_folder,
:long => "--payload_folder FOLDER",
:description => "Folder to copy to the remote server",
:boolean => false
end
end
|