bolt 2.15.0 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bolt-modules/boltlib/lib/puppet/functions/add_facts.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/add_to_group.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/catch_errors.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/facts.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/fail_plan.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_resources.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_target.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_targets.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_fact.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/resolve_references.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/resource.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +2 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +2 -1
- data/bolt-modules/boltlib/lib/puppet/functions/set_config.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_resources.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_var.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/vars.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/wait_until_available.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/write_file.rb +1 -0
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb +2 -0
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/sleep.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -0
- data/bolt-modules/file/lib/puppet/functions/file/join.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/write.rb +2 -0
- data/bolt-modules/out/lib/puppet/functions/out/message.rb +2 -0
- data/bolt-modules/prompt/lib/puppet/functions/prompt.rb +1 -0
- data/bolt-modules/system/lib/puppet/functions/system/env.rb +2 -0
- data/lib/bolt/applicator.rb +2 -1
- data/lib/bolt/bolt_option_parser.rb +7 -7
- data/lib/bolt/cli.rb +3 -4
- data/lib/bolt/config.rb +14 -117
- data/lib/bolt/config/options.rb +321 -0
- data/lib/bolt/config/transport/base.rb +16 -16
- data/lib/bolt/config/transport/docker.rb +9 -23
- data/lib/bolt/config/transport/local.rb +6 -44
- data/lib/bolt/config/transport/options.rb +305 -0
- data/lib/bolt/config/transport/orch.rb +9 -18
- data/lib/bolt/config/transport/remote.rb +3 -6
- data/lib/bolt/config/transport/ssh.rb +55 -149
- data/lib/bolt/config/transport/winrm.rb +18 -47
- data/lib/bolt/inventory/group.rb +1 -1
- data/lib/bolt/inventory/inventory.rb +0 -14
- data/lib/bolt/inventory/target.rb +18 -5
- data/lib/bolt/pal.rb +3 -1
- data/lib/bolt/project.rb +21 -38
- data/lib/bolt/shell/bash.rb +9 -9
- data/lib/bolt/shell/powershell.rb +2 -1
- data/lib/bolt/transport/docker.rb +1 -1
- data/lib/bolt/version.rb +1 -1
- metadata +4 -2
data/lib/bolt/config.rb
CHANGED
@@ -13,6 +13,7 @@ require 'bolt/config/transport/orch'
|
|
13
13
|
require 'bolt/config/transport/local'
|
14
14
|
require 'bolt/config/transport/docker'
|
15
15
|
require 'bolt/config/transport/remote'
|
16
|
+
require 'bolt/config/options'
|
16
17
|
|
17
18
|
module Bolt
|
18
19
|
class UnknownTransportError < Bolt::Error
|
@@ -23,6 +24,8 @@ module Bolt
|
|
23
24
|
end
|
24
25
|
|
25
26
|
class Config
|
27
|
+
include Bolt::Config::Options
|
28
|
+
|
26
29
|
attr_reader :config_files, :warnings, :data, :transports, :project, :modified_concurrency
|
27
30
|
|
28
31
|
BOLT_CONFIG_NAME = 'bolt.yaml'
|
@@ -39,114 +42,7 @@ module Bolt
|
|
39
42
|
'remote' => Bolt::Config::Transport::Remote
|
40
43
|
}.freeze
|
41
44
|
|
42
|
-
#
|
43
|
-
# bolt-defaults.yaml.
|
44
|
-
BOLT_CONFIG = {
|
45
|
-
"color" => "Whether to use colored output when printing messages to the console.",
|
46
|
-
"compile-concurrency" => "The maximum number of simultaneous manifest block compiles.",
|
47
|
-
"concurrency" => "The number of threads to use when executing on remote targets.",
|
48
|
-
"format" => "The format to use when printing results. Options are `human` and `json`.",
|
49
|
-
"plugin_hooks" => "Which plugins a specific hook should use.",
|
50
|
-
"plugins" => "A map of plugins and their configuration data.",
|
51
|
-
"puppetdb" => "A map containing options for configuring the Bolt PuppetDB client.",
|
52
|
-
"puppetfile" => "A map containing options for the `bolt puppetfile install` command.",
|
53
|
-
"save-rerun" => "Whether to update `.rerun.json` in the Bolt project directory. If "\
|
54
|
-
"your target names include passwords, set this value to `false` to avoid "\
|
55
|
-
"writing passwords to disk."
|
56
|
-
}.freeze
|
57
|
-
|
58
|
-
# These options are only available to bolt-defaults.yaml.
|
59
|
-
DEFAULTS_CONFIG = {
|
60
|
-
"inventory-config" => "A map of default configuration options for the inventory. This includes options "\
|
61
|
-
"for setting the default transport to use when connecting to targets, as well as "\
|
62
|
-
"options for configuring the default behavior of each transport."
|
63
|
-
}.freeze
|
64
|
-
|
65
|
-
# Options that configure the inventory, specifically the default transport
|
66
|
-
# used by targets and the transports themselves. These options are used in
|
67
|
-
# bolt.yaml, inventory.yaml, and under the inventory-config key in
|
68
|
-
# bolt-defaults.yaml.
|
69
|
-
INVENTORY_CONFIG = {
|
70
|
-
"transport" => "The default transport to use when the transport for a target is not specified in the URI.",
|
71
|
-
"docker" => "A map of configuration options for the docker transport.",
|
72
|
-
"local" => "A map of configuration options for the local transport.",
|
73
|
-
"pcp" => "A map of configuration options for the pcp transport.",
|
74
|
-
"remote" => "A map of configuration options for the remote transport.",
|
75
|
-
"ssh" => "A map of configuration options for the ssh transport.",
|
76
|
-
"winrm" => "A map of configuration options for the winrm transport."
|
77
|
-
}.freeze
|
78
|
-
|
79
|
-
# Options that configure the project, such as paths to files used for a
|
80
|
-
# specific project. These settings are used in bolt.yaml and bolt-project.yaml.
|
81
|
-
PROJECT_CONFIG = {
|
82
|
-
"apply_settings" => "A map of Puppet settings to use when applying Puppet code",
|
83
|
-
"hiera-config" => "The path to your Hiera config.",
|
84
|
-
"inventoryfile" => "The path to a structured data inventory file used to refer to groups of "\
|
85
|
-
"targets on the command line and from plans.",
|
86
|
-
"log" => "The configuration of the logfile output. Configuration can be set for "\
|
87
|
-
"`console` and the path to a log file, such as `~/.puppetlabs/bolt/debug.log`.",
|
88
|
-
"modulepath" => "An array of directories that Bolt loads content (e.g. plans and tasks) from.",
|
89
|
-
"trusted-external-command" => "The path to an executable on the Bolt controller that can produce "\
|
90
|
-
"external trusted facts. **External trusted facts are experimental in both "\
|
91
|
-
"Puppet and Bolt and this API may change or be removed.**"
|
92
|
-
}.freeze
|
93
|
-
|
94
|
-
# A combined map of all configuration options that can be set in this class.
|
95
|
-
# Includes all options except 'inventory-config', which is munged when loading
|
96
|
-
# a bolt-defaults.yaml file.
|
97
|
-
OPTIONS = BOLT_CONFIG.merge(INVENTORY_CONFIG).merge(PROJECT_CONFIG).freeze
|
98
|
-
|
99
|
-
# Default values for select options. These do not set the default values in Bolt
|
100
|
-
# and are only used for documentation.
|
101
|
-
DEFAULT_OPTIONS = {
|
102
|
-
"color" => true,
|
103
|
-
"compile-concurrency" => "Number of cores",
|
104
|
-
"concurrency" => "100 or one-seventh of the ulimit, whichever is lower",
|
105
|
-
"format" => "human",
|
106
|
-
"hiera-config" => "Boltdir/hiera.yaml",
|
107
|
-
"inventoryfile" => "Boltdir/inventory.yaml",
|
108
|
-
"modulepath" => ["Boltdir/modules", "Boltdir/site-modules", "Boltdir/site"],
|
109
|
-
"save-rerun" => true,
|
110
|
-
"transport" => "ssh"
|
111
|
-
}.freeze
|
112
|
-
|
113
|
-
PUPPETDB_OPTIONS = {
|
114
|
-
"cacert" => "The path to the ca certificate for PuppetDB.",
|
115
|
-
"cert" => "The path to the client certificate file to use for authentication.",
|
116
|
-
"key" => "The private key for the certificate.",
|
117
|
-
"server_urls" => "An array containing the PuppetDB host to connect to. Include the protocol `https` and "\
|
118
|
-
"the port, which is usually `8081`. For example, `https://my-master.example.com:8081`.",
|
119
|
-
"token" => "The path to the PE RBAC Token."
|
120
|
-
}.freeze
|
121
|
-
|
122
|
-
PUPPETFILE_OPTIONS = {
|
123
|
-
"forge" => "A subsection that can have its own `proxy` setting to set an HTTP proxy for Forge operations "\
|
124
|
-
"only, and a `baseurl` setting to specify a different Forge host.",
|
125
|
-
"proxy" => "The HTTP proxy to use for Git and Forge operations."
|
126
|
-
}.freeze
|
127
|
-
|
128
|
-
LOG_OPTIONS = {
|
129
|
-
"append" => "Add output to an existing log file. Available only for logs output to a "\
|
130
|
-
"filepath.",
|
131
|
-
"level" => "The type of information in the log. Either `debug`, `info`, `notice`, "\
|
132
|
-
"`warn`, or `error`."
|
133
|
-
}.freeze
|
134
|
-
|
135
|
-
DEFAULT_LOG_OPTIONS = {
|
136
|
-
"append" => true,
|
137
|
-
"level" => "`warn` for console, `notice` for file"
|
138
|
-
}.freeze
|
139
|
-
|
140
|
-
APPLY_SETTINGS = {
|
141
|
-
"show_diff" => "Whether to log and report a contextual diff when files are being replaced. "\
|
142
|
-
"See [Puppet documentation](https://puppet.com/docs/puppet/latest/configuration.html#showdiff) "\
|
143
|
-
"for details"
|
144
|
-
}.freeze
|
145
|
-
|
146
|
-
DEFAULT_APPLY_SETTINGS = {
|
147
|
-
"show_diff" => false
|
148
|
-
}.freeze
|
149
|
-
|
45
|
+
# The default concurrency value that is used when the ulimit is not low (i.e. < 700)
|
150
46
|
DEFAULT_DEFAULT_CONCURRENCY = 100
|
151
47
|
|
152
48
|
def self.default
|
@@ -221,18 +117,18 @@ module Bolt
|
|
221
117
|
end
|
222
118
|
|
223
119
|
# Remove project-specific config such as hiera-config, etc.
|
224
|
-
project_config = data.slice(*
|
120
|
+
project_config = data.slice(*(BOLT_PROJECT_OPTIONS - BOLT_DEFAULTS_OPTIONS))
|
225
121
|
|
226
122
|
if project_config.any?
|
227
123
|
data.reject! { |key, _| project_config.include?(key) }
|
228
124
|
warnings.push(
|
229
125
|
msg: "Unsupported project configuration detected in '#{filepath}': #{project_config.keys}. "\
|
230
|
-
|
126
|
+
"Project configuration should be set in 'bolt-project.yaml'."
|
231
127
|
)
|
232
128
|
end
|
233
129
|
|
234
130
|
# Remove top-level transport config such as transport, ssh, etc.
|
235
|
-
transport_config = data.slice(*
|
131
|
+
transport_config = data.slice(*INVENTORY_OPTIONS.keys)
|
236
132
|
|
237
133
|
if transport_config.any?
|
238
134
|
data.reject! { |key, _| transport_config.include?(key) }
|
@@ -347,12 +243,13 @@ module Bolt
|
|
347
243
|
def normalize_overrides(options)
|
348
244
|
opts = options.transform_keys(&:to_s)
|
349
245
|
|
350
|
-
# Pull out config options
|
351
|
-
|
246
|
+
# Pull out config options. We need to add 'transport' as it's not part of the
|
247
|
+
# OPTIONS hash but is a valid option that can be set with the --transport CLI option
|
248
|
+
overrides = opts.slice(*OPTIONS.keys, 'transport')
|
352
249
|
|
353
250
|
# Pull out transport config options
|
354
251
|
TRANSPORT_CONFIG.each do |transport, config|
|
355
|
-
overrides[transport] = opts.slice(*config.options
|
252
|
+
overrides[transport] = opts.slice(*config.options)
|
356
253
|
end
|
357
254
|
|
358
255
|
# Set console log to debug if in debug mode
|
@@ -419,8 +316,8 @@ module Bolt
|
|
419
316
|
end
|
420
317
|
|
421
318
|
# Filter hashes to only include valid options
|
422
|
-
@data['apply_settings'] = @data['apply_settings'].slice(*
|
423
|
-
@data['puppetfile'] = @data['puppetfile'].slice(*
|
319
|
+
@data['apply_settings'] = @data['apply_settings'].slice(*SUBOPTIONS['apply_settings'].keys)
|
320
|
+
@data['puppetfile'] = @data['puppetfile'].slice(*SUBOPTIONS['puppetfile'].keys)
|
424
321
|
end
|
425
322
|
|
426
323
|
private def normalize_log(target)
|
@@ -434,7 +331,7 @@ module Bolt
|
|
434
331
|
next unless val.is_a?(Hash)
|
435
332
|
|
436
333
|
name = normalize_log(key)
|
437
|
-
acc[name] = val.slice(*
|
334
|
+
acc[name] = val.slice(*SUBOPTIONS['log'].keys)
|
438
335
|
.transform_keys(&:to_sym)
|
439
336
|
|
440
337
|
if (v = acc[name][:level])
|
@@ -0,0 +1,321 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bolt
|
4
|
+
class Config
|
5
|
+
module Options
|
6
|
+
# The following constants define the various configuration options available to Bolt.
|
7
|
+
# Each constant is a hash where keys are the configuration option and values are the
|
8
|
+
# data describing the option. Data includes the following keys:
|
9
|
+
# :def The **documented** default value. This is the value that is displayed
|
10
|
+
# in the reference docs and is not used by Bolt to actually set a default
|
11
|
+
# value.
|
12
|
+
# :desc The text description of the option that is displayed in documentation.
|
13
|
+
# :exmp An example value for the option. This is used to generate an example
|
14
|
+
# configuration file in the reference docs.
|
15
|
+
# :type The option's expected type. If an option accepts multiple types, this is
|
16
|
+
# an array of the accepted types. Any options that accept a Boolean value
|
17
|
+
# should use the [TrueClass, FalseClass] type.
|
18
|
+
OPTIONS = {
|
19
|
+
"apply_settings" => {
|
20
|
+
desc: "A map of Puppet settings to use when applying Puppet code using the `apply` "\
|
21
|
+
"plan function or the `bolt apply` command.",
|
22
|
+
type: Hash
|
23
|
+
},
|
24
|
+
"color" => {
|
25
|
+
desc: "Whether to use colored output when printing messages to the console.",
|
26
|
+
type: [TrueClass, FalseClass],
|
27
|
+
exmp: false,
|
28
|
+
def: true
|
29
|
+
},
|
30
|
+
"compile-concurrency" => {
|
31
|
+
desc: "The maximum number of simultaneous manifest block compiles.",
|
32
|
+
type: Integer,
|
33
|
+
exmp: 4,
|
34
|
+
def: "Number of cores."
|
35
|
+
},
|
36
|
+
"concurrency" => {
|
37
|
+
desc: "The number of threads to use when executing on remote targets.",
|
38
|
+
type: Integer,
|
39
|
+
exmp: 50,
|
40
|
+
def: "100 or 1/7 the ulimit, whichever is lower."
|
41
|
+
},
|
42
|
+
"format" => {
|
43
|
+
desc: "The format to use when printing results. Options are `human`, `json`, and `rainbow`.",
|
44
|
+
type: String,
|
45
|
+
exmp: "json",
|
46
|
+
def: "human"
|
47
|
+
},
|
48
|
+
"hiera-config" => {
|
49
|
+
desc: "The path to your Hiera config.",
|
50
|
+
type: String,
|
51
|
+
def: "project/hiera.yaml",
|
52
|
+
exmp: "~/.puppetlabs/bolt/hiera.yaml"
|
53
|
+
},
|
54
|
+
"inventory-config" => {
|
55
|
+
desc: "A map of default configuration options for the inventory. This includes options "\
|
56
|
+
"for setting the default transport to use when connecting to targets, as well as "\
|
57
|
+
"options for configuring the default behavior of each transport.",
|
58
|
+
type: Hash
|
59
|
+
},
|
60
|
+
"inventoryfile" => {
|
61
|
+
desc: "The path to a structured data inventory file used to refer to groups of targets on the command "\
|
62
|
+
"line and from plans. Read more about using inventory files in [Inventory "\
|
63
|
+
"files](inventory_file_v2.md).",
|
64
|
+
type: String,
|
65
|
+
def: "project/inventory.yaml",
|
66
|
+
exmp: "~/.puppetlabs/bolt/inventory.yaml"
|
67
|
+
},
|
68
|
+
"log" => {
|
69
|
+
desc: "A map of configuration for the logfile output. Configuration can be set for "\
|
70
|
+
"`console` and individual log files, such as `~/.puppetlabs/bolt/debug.log`. "\
|
71
|
+
"Each key in the map is the logfile output to configure, with the corresponding "\
|
72
|
+
"value configuring the logfile output.",
|
73
|
+
type: Hash,
|
74
|
+
exmp: { "console" => { "level" => "info" },
|
75
|
+
"~/logs/debug.log" => { "append" => false, "level" => "debug" } }
|
76
|
+
},
|
77
|
+
"modulepath" => {
|
78
|
+
desc: "An array of directories that Bolt loads content such as plans and tasks from. Read more "\
|
79
|
+
"about modules in [Module structure](module_structure.md).",
|
80
|
+
type: [Array, String],
|
81
|
+
def: ["project/modules", "project/site-modules", "project/site"],
|
82
|
+
exmp: ["~/.puppetlabs/bolt/modules", "~/.puppetlabs/bolt/site-modules"]
|
83
|
+
},
|
84
|
+
"name" => {
|
85
|
+
desc: "The name of the Bolt project. When this option is configured, the project is considered a "\
|
86
|
+
"[Bolt project](experimental_features.md#bolt-projects), allowing Bolt to load content from "\
|
87
|
+
"the project directory as though it were a module.",
|
88
|
+
type: String,
|
89
|
+
exmp: "myproject"
|
90
|
+
},
|
91
|
+
"plans" => {
|
92
|
+
desc: "A list of plan names to show in `bolt plan show` output, if they exist. This option is used to "\
|
93
|
+
"limit the visibility of plans for users of the project. For example, project authors might want to "\
|
94
|
+
"limit the visibility of plans that are bundled with Bolt or plans that should only be run as "\
|
95
|
+
"part of another plan. When this option is not configured, all plans are visible. This "\
|
96
|
+
"option does not prevent users from running plans that are not part of this list.",
|
97
|
+
type: Array,
|
98
|
+
exmp: ["myproject", "myproject::foo", "myproject::bar"]
|
99
|
+
},
|
100
|
+
"plugin_hooks" => {
|
101
|
+
desc: "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. "\
|
102
|
+
"The only configurable plugin hook is `puppet_library`, which can use two possible plugins: "\
|
103
|
+
"[`puppet_agent`](https://github.com/puppetlabs/puppetlabs-puppet_agent#puppet_agentinstall) "\
|
104
|
+
"and [`task`](using_plugins.md#task).",
|
105
|
+
type: Hash,
|
106
|
+
exmp: { "puppet_library" => { "plugin" => "puppet_agent", "version" => "6.15.0", "_run_as" => "root" } }
|
107
|
+
},
|
108
|
+
"plugins" => {
|
109
|
+
desc: "A map of plugins and their configuration data, where each key is the name of a plugin and its "\
|
110
|
+
"value is a map of configuration data. Configurable options are specified by the plugin. Read "\
|
111
|
+
"more about configuring plugins in [Using plugins](using_plugins.md#configuring-plugins).",
|
112
|
+
type: Hash,
|
113
|
+
exmp: { "pkcs7" => { "keysize" => 1024 } }
|
114
|
+
},
|
115
|
+
"puppetdb" => {
|
116
|
+
desc: "A map containing options for [configuring the Bolt PuppetDB client](bolt_connect_puppetdb.md).",
|
117
|
+
type: Hash
|
118
|
+
},
|
119
|
+
"puppetfile" => {
|
120
|
+
desc: "A map containing options for the `bolt puppetfile install` command.",
|
121
|
+
type: Hash
|
122
|
+
},
|
123
|
+
"save-rerun" => {
|
124
|
+
desc: "Whether to update `.rerun.json` in the Bolt project directory. If "\
|
125
|
+
"your target names include passwords, set this value to `false` to avoid "\
|
126
|
+
"writing passwords to disk.",
|
127
|
+
type: [TrueClass, FalseClass],
|
128
|
+
exmp: false,
|
129
|
+
def: true
|
130
|
+
},
|
131
|
+
"tasks" => {
|
132
|
+
desc: "A list of task names to show in `bolt task show` output, if they exist. This option is used to "\
|
133
|
+
"limit the visibility of tasks for users of the project. For example, project authors might want to "\
|
134
|
+
"limit the visibility of tasks that are bundled with Bolt or plans that should only be run as "\
|
135
|
+
"part of a larger workflow. When this option is not configured, all tasks are visible. This "\
|
136
|
+
"option does not prevent users from running tasks that are not part of this list.",
|
137
|
+
type: Array,
|
138
|
+
exmp: ["myproject", "myproject::foo", "myproject::bar"]
|
139
|
+
},
|
140
|
+
"trusted-external-command" => {
|
141
|
+
desc: "The path to an executable on the Bolt controller that can produce external trusted facts. "\
|
142
|
+
"**External trusted facts are experimental in both Puppet and Bolt and this API may change or "\
|
143
|
+
"be removed.**",
|
144
|
+
type: String,
|
145
|
+
exmp: "/etc/puppetlabs/facts/trusted_external.sh"
|
146
|
+
}
|
147
|
+
}.freeze
|
148
|
+
|
149
|
+
# Options that configure the inventory, specifically the default transport
|
150
|
+
# used by targets and the transports themselves. These options are used in
|
151
|
+
# bolt.yaml, under a 'config' key in inventory.yaml, and under the
|
152
|
+
# 'inventory-config' key in bolt-defaults.yaml.
|
153
|
+
INVENTORY_OPTIONS = {
|
154
|
+
"transport" => {
|
155
|
+
desc: "The default transport to use when the transport for a target is not "\
|
156
|
+
"specified in the URI.",
|
157
|
+
type: String,
|
158
|
+
def: "ssh",
|
159
|
+
exmp: "winrm"
|
160
|
+
},
|
161
|
+
"docker" => {
|
162
|
+
desc: "A map of configuration options for the docker transport.",
|
163
|
+
type: Hash,
|
164
|
+
exmp: { "cleanup" => false, "service-url" => "https://docker.example.com" }
|
165
|
+
},
|
166
|
+
"local" => {
|
167
|
+
desc: "A map of configuration options for the local transport. The set of available options is "\
|
168
|
+
"platform dependent.",
|
169
|
+
type: Hash,
|
170
|
+
exmp: { "cleanup" => false, "tmpdir" => "/tmp/bolt" }
|
171
|
+
},
|
172
|
+
"pcp" => {
|
173
|
+
desc: "A map of configuration options for the pcp transport.",
|
174
|
+
type: Hash,
|
175
|
+
exmp: { "job-poll-interval" => 15, "job-poll-timeout" => 30 }
|
176
|
+
},
|
177
|
+
"remote" => {
|
178
|
+
desc: "A map of configuration options for the remote transport.",
|
179
|
+
type: Hash,
|
180
|
+
exmp: { "run-on" => "proxy_target" }
|
181
|
+
},
|
182
|
+
"ssh" => {
|
183
|
+
desc: "A map of configuration options for the ssh transport.",
|
184
|
+
type: Hash,
|
185
|
+
exmp: { "password" => "hunter2!", "user" => "bolt" }
|
186
|
+
},
|
187
|
+
"winrm" => {
|
188
|
+
desc: "A map of configuration options for the winrm transport.",
|
189
|
+
type: Hash,
|
190
|
+
exmp: { "password" => "hunter2!", "user" => "bolt" }
|
191
|
+
}
|
192
|
+
}.freeze
|
193
|
+
|
194
|
+
# Suboptions for options that accept hashes.
|
195
|
+
SUBOPTIONS = {
|
196
|
+
"apply_settings" => {
|
197
|
+
"show_diff" => {
|
198
|
+
desc: "Whether to log and report a contextual diff when files are being replaced. See "\
|
199
|
+
"[Puppet documentation](https://puppet.com/docs/puppet/latest/configuration.html#showdiff) "\
|
200
|
+
"for details.",
|
201
|
+
type: [TrueClass, FalseClass],
|
202
|
+
exmp: true,
|
203
|
+
def: false
|
204
|
+
}
|
205
|
+
},
|
206
|
+
"inventory-config" => INVENTORY_OPTIONS,
|
207
|
+
"log" => {
|
208
|
+
"append" => {
|
209
|
+
desc: "Add output to an existing log file. Available only for logs output to a "\
|
210
|
+
"filepath.",
|
211
|
+
type: [TrueClass, FalseClass],
|
212
|
+
def: true
|
213
|
+
},
|
214
|
+
"level" => {
|
215
|
+
desc: "The type of information in the log. Either `debug`, `info`, `notice`, "\
|
216
|
+
"`warn`, or `error`.",
|
217
|
+
type: String,
|
218
|
+
def: "`warn` for console, `notice` for file"
|
219
|
+
}
|
220
|
+
},
|
221
|
+
"puppetdb" => {
|
222
|
+
"cacert" => {
|
223
|
+
desc: "The path to the ca certificate for PuppetDB.",
|
224
|
+
type: String,
|
225
|
+
exmp: "/etc/puppetlabs/puppet/ssl/certs/ca.pem"
|
226
|
+
},
|
227
|
+
"cert" => {
|
228
|
+
desc: "The path to the client certificate file to use for authentication.",
|
229
|
+
type: String,
|
230
|
+
exmp: "/etc/puppetlabs/puppet/ssl/certs/my-host.example.com.pem"
|
231
|
+
},
|
232
|
+
"key" => {
|
233
|
+
desc: "The private key for the certificate.",
|
234
|
+
type: String,
|
235
|
+
exmp: "/etc/puppetlabs/puppet/ssl/private_keys/my-host.example.com.pem"
|
236
|
+
},
|
237
|
+
"server_urls" => {
|
238
|
+
desc: "An array containing the PuppetDB host to connect to. Include the protocol `https` "\
|
239
|
+
"and the port, which is usually `8081`. For example, "\
|
240
|
+
"`https://my-master.example.com:8081`.",
|
241
|
+
type: Array,
|
242
|
+
exmp: ["https://puppet.example.com:8081"]
|
243
|
+
},
|
244
|
+
"token" => {
|
245
|
+
desc: "The path to the PE RBAC Token.",
|
246
|
+
type: String,
|
247
|
+
exmp: "~/.puppetlabs/token"
|
248
|
+
}
|
249
|
+
},
|
250
|
+
"puppetfile" => {
|
251
|
+
"forge" => {
|
252
|
+
desc: "A subsection that can have its own `proxy` setting to set an HTTP proxy for Forge "\
|
253
|
+
"operations only, and a `baseurl` setting to specify a different Forge host.",
|
254
|
+
type: Hash,
|
255
|
+
exmp: { "baseurl" => "https://forge.example.com", "proxy" => "https://forgeapi.example.com" }
|
256
|
+
},
|
257
|
+
"proxy" => {
|
258
|
+
desc: "The HTTP proxy to use for Git and Forge operations.",
|
259
|
+
type: String,
|
260
|
+
exmp: "https://forgeapi.example.com"
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}.freeze
|
264
|
+
|
265
|
+
# Options that are available in a bolt.yaml file
|
266
|
+
BOLT_OPTIONS = %w[
|
267
|
+
apply_settings
|
268
|
+
color
|
269
|
+
compile-concurrency
|
270
|
+
concurrency
|
271
|
+
format
|
272
|
+
hiera-config
|
273
|
+
inventoryfile
|
274
|
+
log
|
275
|
+
modulepath
|
276
|
+
plugin_hooks
|
277
|
+
plugins
|
278
|
+
puppetdb
|
279
|
+
puppetfile
|
280
|
+
save-rerun
|
281
|
+
trusted-external-command
|
282
|
+
].freeze
|
283
|
+
|
284
|
+
# Options that are available in a bolt-defaults.yaml file
|
285
|
+
BOLT_DEFAULTS_OPTIONS = %w[
|
286
|
+
color
|
287
|
+
compile-concurrency
|
288
|
+
concurrency
|
289
|
+
format
|
290
|
+
inventory-config
|
291
|
+
plugin_hooks
|
292
|
+
plugins
|
293
|
+
puppetdb
|
294
|
+
puppetfile
|
295
|
+
save-rerun
|
296
|
+
].freeze
|
297
|
+
|
298
|
+
# Options that are available in a bolt-project.yaml file
|
299
|
+
BOLT_PROJECT_OPTIONS = %w[
|
300
|
+
apply_settings
|
301
|
+
color
|
302
|
+
compile-concurrency
|
303
|
+
concurrency
|
304
|
+
format
|
305
|
+
hiera-config
|
306
|
+
inventoryfile
|
307
|
+
log
|
308
|
+
modulepath
|
309
|
+
name
|
310
|
+
plans
|
311
|
+
plugin_hooks
|
312
|
+
plugins
|
313
|
+
puppetdb
|
314
|
+
puppetfile
|
315
|
+
save-rerun
|
316
|
+
tasks
|
317
|
+
trusted-external-command
|
318
|
+
].freeze
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|