Module: Chef::Knife::BootstrapWindowsBase

Included in:
BootstrapWindowsSsh, BootstrapWindowsWinrm
Defined in:
lib/chef/knife/helpers/bootstrap_windows_base.rb

Class Method Summary collapse

Class Method Details

.included(includer) ⇒ Object

:nodoc: Would prefer to do this in a rational way, but can’t be done b/c of Mixlib::CLI’s design :(



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
# File 'lib/chef/knife/helpers/bootstrap_windows_base.rb', line 28

def self.included(includer)
  includer.class_eval do

    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"

    option :bootstrap_proxy,
      long: "--bootstrap-proxy PROXY_URL",
      description: "The proxy server for the node being bootstrapped"

    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"

    option :bootstrap_install_command,
      long: "--bootstrap-install-command COMMANDS",
      description: "Custom command to install chef-client"

    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 :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, accumulator|
        accumulator ||= {}
        name, path = h.split("=")
        accumulator[name] = path ? Chef::JSONCompat.parse(::File.read(path)) : {}
        accumulator
      }

    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

    # Mismatch between option 'encrypted_data_bag_secret' and it's long value '--secret' is by design for compatibility
    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

    # Mismatch between option 'encrypted_data_bag_secret_file' and it's long value '--secret-file' is by design for compatibility
    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 = %w{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, accumulator|
        (vault, item) = i.split(/:/)
        accumulator ||= {}
        accumulator[vault] ||= []
        accumulator[vault].push(item)
        accumulator
      }

    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: []
  end
end