bolt 2.11.1 → 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/Puppetfile +1 -1
- data/bolt-modules/boltlib/lib/puppet/datatypes/resourceinstance.rb +3 -2
- 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/apply_prep.rb +1 -1
- 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 +2 -1
- 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 +53 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +67 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +6 -3
- data/bolt-modules/boltlib/lib/puppet/functions/run_task_with.rb +8 -2
- 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 +66 -43
- 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 +2 -1
- data/bolt-modules/file/lib/puppet/functions/file/join.rb +2 -0
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +3 -1
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +3 -1
- 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/analytics.rb +21 -2
- data/lib/bolt/applicator.rb +20 -7
- data/lib/bolt/apply_inventory.rb +4 -0
- data/lib/bolt/apply_target.rb +4 -0
- data/lib/bolt/bolt_option_parser.rb +11 -10
- data/lib/bolt/catalog.rb +81 -68
- data/lib/bolt/cli.rb +18 -8
- data/lib/bolt/config.rb +152 -120
- 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 +59 -114
- data/lib/bolt/config/transport/winrm.rb +18 -47
- data/lib/bolt/executor.rb +14 -1
- data/lib/bolt/inventory/group.rb +1 -1
- data/lib/bolt/inventory/inventory.rb +4 -14
- data/lib/bolt/inventory/target.rb +22 -5
- data/lib/bolt/outputter.rb +3 -0
- data/lib/bolt/outputter/rainbow.rb +80 -0
- data/lib/bolt/pal.rb +6 -1
- data/lib/bolt/project.rb +66 -46
- data/lib/bolt/resource_instance.rb +10 -3
- data/lib/bolt/shell/bash.rb +9 -9
- data/lib/bolt/shell/powershell.rb +2 -1
- data/lib/bolt/shell/powershell/snippets.rb +8 -0
- data/lib/bolt/transport/docker.rb +1 -1
- data/lib/bolt/transport/local/connection.rb +2 -1
- data/lib/bolt/transport/ssh/connection.rb +35 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_spec/bolt_context.rb +1 -1
- data/lib/bolt_spec/run.rb +1 -1
- metadata +23 -5
@@ -2,11 +2,14 @@
|
|
2
2
|
|
3
3
|
require 'bolt/error'
|
4
4
|
require 'bolt/util'
|
5
|
+
require 'bolt/config/transport/options'
|
5
6
|
|
6
7
|
module Bolt
|
7
8
|
class Config
|
8
9
|
module Transport
|
9
10
|
class Base
|
11
|
+
include Bolt::Config::Transport::Options
|
12
|
+
|
10
13
|
attr_reader :input
|
11
14
|
|
12
15
|
def initialize(data = {}, project = nil)
|
@@ -96,7 +99,7 @@ module Bolt
|
|
96
99
|
end
|
97
100
|
|
98
101
|
private def filter(unfiltered)
|
99
|
-
unfiltered.slice(*self.class.options
|
102
|
+
unfiltered.slice(*self.class.options)
|
100
103
|
end
|
101
104
|
|
102
105
|
private def assert_hash_or_config(data)
|
@@ -116,24 +119,21 @@ module Bolt
|
|
116
119
|
assert_type
|
117
120
|
end
|
118
121
|
|
119
|
-
# Validates that each option is the correct type. Types are loaded from the
|
122
|
+
# Validates that each option is the correct type. Types are loaded from the TRANSPORT_OPTIONS hash.
|
120
123
|
private def assert_type
|
121
124
|
@config.each_pair do |opt, val|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
if
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
131
|
-
else
|
132
|
-
unless val.nil? || val.is_a?(type)
|
133
|
-
raise Bolt::ValidationError,
|
134
|
-
"#{opt} must be a #{type}, received #{val.class} #{val.inspect}"
|
135
|
-
end
|
125
|
+
types = Array(TRANSPORT_OPTIONS.dig(opt, :type)).compact
|
126
|
+
|
127
|
+
next if val.nil? || types.empty? || types.include?(val.class)
|
128
|
+
|
129
|
+
# Ruby doesn't have a Boolean class, so add it to the types list if TrueClass or FalseClass
|
130
|
+
# are present.
|
131
|
+
if types.include?(TrueClass) || types.include?(FalseClass)
|
132
|
+
types = types - [TrueClass, FalseClass] + ['Boolean']
|
136
133
|
end
|
134
|
+
|
135
|
+
raise Bolt::ValidationError,
|
136
|
+
"#{opt} must be of type #{types.join(', ')}; received #{val.class} #{val.inspect} "
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
@@ -7,29 +7,15 @@ module Bolt
|
|
7
7
|
class Config
|
8
8
|
module Transport
|
9
9
|
class Docker < Base
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
"enabling you to override the shebang defined in a task executable. The "\
|
20
|
-
"extension can optionally be specified with the `.` character (`.py` and "\
|
21
|
-
"`py` both map to a task executable `task.py`) and the extension is case "\
|
22
|
-
"sensitive. When a target's name is `localhost`, Ruby tasks run with the "\
|
23
|
-
"Bolt Ruby interpreter by default." },
|
24
|
-
"service-url" => { type: String,
|
25
|
-
desc: "URL of the Docker host used for API requests." },
|
26
|
-
"shell-command" => { type: String,
|
27
|
-
desc: "A shell command to wrap any Docker exec commands in, such as `bash -lc`." },
|
28
|
-
"tmpdir" => { type: String,
|
29
|
-
desc: "The directory to upload and execute temporary files on the target." },
|
30
|
-
"tty" => { type: TrueClass,
|
31
|
-
desc: "Whether to enable tty on exec commands." }
|
32
|
-
}.freeze
|
10
|
+
OPTIONS = %w[
|
11
|
+
cleanup
|
12
|
+
host
|
13
|
+
interpreters
|
14
|
+
service-url
|
15
|
+
shell-command
|
16
|
+
tmpdir
|
17
|
+
tty
|
18
|
+
].freeze
|
33
19
|
|
34
20
|
DEFAULTS = {
|
35
21
|
'cleanup' => true
|
@@ -7,51 +7,13 @@ module Bolt
|
|
7
7
|
class Config
|
8
8
|
module Transport
|
9
9
|
class Local < Base
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
"interpreters" => { type: Hash,
|
16
|
-
desc: "A map of an extension name to the absolute path of an executable, "\
|
17
|
-
"enabling you to override the shebang defined in a task executable. The "\
|
18
|
-
"extension can optionally be specified with the `.` character (`.py` and "\
|
19
|
-
"`py` both map to a task executable `task.py`) and the extension is case "\
|
20
|
-
"sensitive. When a target's name is `localhost`, Ruby tasks run with the "\
|
21
|
-
"Bolt Ruby interpreter by default." },
|
22
|
-
"run-as" => { type: String,
|
23
|
-
desc: "A different user to run commands as after login." },
|
24
|
-
"run-as-command" => { type: Array,
|
25
|
-
desc: "The command to elevate permissions. Bolt appends the user and command "\
|
26
|
-
"strings to the configured `run-as-command` before running it on the target. "\
|
27
|
-
"This command must not require an interactive password prompt, and the "\
|
28
|
-
"`sudo-password` option is ignored when `run-as-command` is specified. The "\
|
29
|
-
"`run-as-command` must be specified as an array." },
|
30
|
-
"sudo-executable" => { type: String,
|
31
|
-
desc: "The executable to use when escalating to the configured `run-as` user. This "\
|
32
|
-
"is useful when you want to escalate using the configured `sudo-password`, "\
|
33
|
-
"since `run-as-command` does not use `sudo-password` or support prompting. "\
|
34
|
-
"The command executed on the target is `<sudo-executable> -S -u <user> -p "\
|
35
|
-
"custom_bolt_prompt <command>`. **This option is experimental.**" },
|
36
|
-
"sudo-password" => { type: String,
|
37
|
-
desc: "Password to use when changing users via `run-as`." },
|
38
|
-
"tmpdir" => { type: String,
|
39
|
-
desc: "The directory to copy and execute temporary files." }
|
40
|
-
}.freeze
|
10
|
+
WINDOWS_OPTIONS = %w[
|
11
|
+
cleanup
|
12
|
+
interpreters
|
13
|
+
tmpdir
|
14
|
+
].freeze
|
41
15
|
|
42
|
-
|
43
|
-
"cleanup" => { type: TrueClass,
|
44
|
-
desc: "Whether to clean up temporary files created on targets." },
|
45
|
-
"interpreters" => { type: Hash,
|
46
|
-
desc: "A map of an extension name to the absolute path of an executable, "\
|
47
|
-
"enabling you to override the shebang defined in a task executable. The "\
|
48
|
-
"extension can optionally be specified with the `.` character (`.py` and "\
|
49
|
-
"`py` both map to a task executable `task.py`) and the extension is case "\
|
50
|
-
"sensitive. When a target's name is `localhost`, Ruby tasks run with the "\
|
51
|
-
"Bolt Ruby interpreter by default." },
|
52
|
-
"tmpdir" => { type: String,
|
53
|
-
desc: "The directory to copy and execute temporary files." }
|
54
|
-
}.freeze
|
16
|
+
OPTIONS = WINDOWS_OPTIONS.dup.concat(RUN_AS_OPTIONS).sort.freeze
|
55
17
|
|
56
18
|
DEFAULTS = {
|
57
19
|
'cleanup' => true
|
@@ -0,0 +1,305 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bolt
|
4
|
+
class Config
|
5
|
+
module Transport
|
6
|
+
module Options
|
7
|
+
LOGIN_SHELLS = %w[sh bash zsh dash ksh powershell].freeze
|
8
|
+
|
9
|
+
# The following constant defines the various configuration options available to Bolt's.
|
10
|
+
# transports. Each key is a configuration option and values are the data describing the
|
11
|
+
# option. Data includes the following keys:
|
12
|
+
# :def The **documented** default value. This is the value that is displayed
|
13
|
+
# in the reference docs and is not used by Bolt to actually set a default
|
14
|
+
# value.
|
15
|
+
# :desc The text description of the option that is displayed in documentation.
|
16
|
+
# :exmp An example value for the option. This is used to generate an example
|
17
|
+
# configuration file in the reference docs.
|
18
|
+
# :type The option's expected type. If an option accepts multiple types, this is
|
19
|
+
# an array of the accepted types. Any options that accept a Boolean value
|
20
|
+
# should use the [TrueClass, FalseClass] type.
|
21
|
+
#
|
22
|
+
# NOTE: All transport configuration options should have a corresponding schema definition
|
23
|
+
# in schemas/bolt-transport-definitions.json
|
24
|
+
TRANSPORT_OPTIONS = {
|
25
|
+
"basic-auth-only" => {
|
26
|
+
type: [TrueClass, FalseClass],
|
27
|
+
desc: "Whether to force basic authentication. This option is only available when using SSL.",
|
28
|
+
def: false,
|
29
|
+
exmp: true
|
30
|
+
},
|
31
|
+
"cacert" => {
|
32
|
+
type: String,
|
33
|
+
desc: "The path to the CA certificate.",
|
34
|
+
exmp: "~/.puppetlabs/puppet/cert.pem"
|
35
|
+
},
|
36
|
+
"cleanup" => {
|
37
|
+
type: [TrueClass, FalseClass],
|
38
|
+
desc: "Whether to clean up temporary files created on targets. When running commands on a target, "\
|
39
|
+
"Bolt may create temporary files. After completing the command, these files are automatically "\
|
40
|
+
"deleted. This value can be set to 'false' if you wish to leave these temporary files on the "\
|
41
|
+
"target.",
|
42
|
+
def: true,
|
43
|
+
exmp: false
|
44
|
+
},
|
45
|
+
"connect-timeout" => {
|
46
|
+
type: Integer,
|
47
|
+
desc: "How long to wait in seconds when establishing connections. Set this value higher if you "\
|
48
|
+
"frequently encounter connection timeout errors when running Bolt.",
|
49
|
+
def: 10,
|
50
|
+
exmp: 15
|
51
|
+
},
|
52
|
+
"copy-command" => {
|
53
|
+
type: [Array, String],
|
54
|
+
desc: "The command to use when copying files using ssh-command. Bolt runs `<copy-command> <src> <dest>`. "\
|
55
|
+
"This option is used when you need support for features or algorithms that are not supported "\
|
56
|
+
"by the net-ssh Ruby library. **This option is experimental.** You can read more about this "\
|
57
|
+
"option in [External SSH transport](experimental_features.md#external-ssh-transport).",
|
58
|
+
def: "scp -r",
|
59
|
+
exmp: "scp -r -F ~/ssh-config/myconf"
|
60
|
+
},
|
61
|
+
"disconnect-timeout" => {
|
62
|
+
type: Integer,
|
63
|
+
desc: "How long to wait in seconds before force-closing a connection.",
|
64
|
+
def: 5,
|
65
|
+
exmp: 10
|
66
|
+
},
|
67
|
+
"encryption-algorithms" => {
|
68
|
+
type: Array,
|
69
|
+
desc: "A list of encryption algorithms to use when establishing a connection "\
|
70
|
+
"to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
|
71
|
+
"viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
|
72
|
+
"non-deprecated algorithms are available by default when this option is not used. To "\
|
73
|
+
"reference all default algorithms using this option, add 'defaults' to the list of "\
|
74
|
+
"supported algorithms.",
|
75
|
+
exmp: %w[defaults idea-cbc]
|
76
|
+
},
|
77
|
+
"extensions" => {
|
78
|
+
type: Array,
|
79
|
+
desc: "A list of file extensions that are accepted for scripts or tasks on "\
|
80
|
+
"Windows. Scripts with these file extensions rely on the target's file "\
|
81
|
+
"type association to run. For example, if Python is installed on the "\
|
82
|
+
"system, a `.py` script runs with `python.exe`. The extensions `.ps1`, "\
|
83
|
+
"`.rb`, and `.pp` are always allowed and run via hard-coded "\
|
84
|
+
"executables.",
|
85
|
+
exmp: [".sh"]
|
86
|
+
},
|
87
|
+
"file-protocol" => {
|
88
|
+
type: String,
|
89
|
+
desc: "Which file transfer protocol to use. Either `winrm` or `smb`. Using `smb` is "\
|
90
|
+
"recommended for large file transfers.",
|
91
|
+
def: "winrm",
|
92
|
+
exmp: "smb"
|
93
|
+
},
|
94
|
+
"host" => {
|
95
|
+
type: String,
|
96
|
+
desc: "The target's hostname.",
|
97
|
+
exmp: "docker_host_production"
|
98
|
+
},
|
99
|
+
"host-key-algorithms" => {
|
100
|
+
type: Array,
|
101
|
+
desc: "A list of host key algorithms to use when establishing a connection "\
|
102
|
+
"to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
|
103
|
+
"viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
|
104
|
+
"non-deprecated algorithms are available by default when this option is not used. To "\
|
105
|
+
"reference all default algorithms using this option, add 'defaults' to the list of "\
|
106
|
+
"supported algorithms.",
|
107
|
+
exmp: %w[defaults ssh-dss]
|
108
|
+
},
|
109
|
+
"host-key-check" => {
|
110
|
+
type: [TrueClass, FalseClass],
|
111
|
+
desc: "Whether to perform host key validation when connecting.",
|
112
|
+
exmp: false
|
113
|
+
},
|
114
|
+
"interpreters" => {
|
115
|
+
type: Hash,
|
116
|
+
desc: "A map of an extension name to the absolute path of an executable, enabling you to override "\
|
117
|
+
"the shebang defined in a task executable. The extension can optionally be specified with the "\
|
118
|
+
"`.` character (`.py` and `py` both map to a task executable `task.py`) and the extension is "\
|
119
|
+
"case sensitive. When a target's name is `localhost`, Ruby tasks run with the Bolt Ruby "\
|
120
|
+
"interpreter by default.",
|
121
|
+
exmp: { "rb" => "/usr/bin/ruby" }
|
122
|
+
},
|
123
|
+
"job-poll-interval" => {
|
124
|
+
type: Integer,
|
125
|
+
desc: "The interval, in seconds, to poll orchestrator for job status.",
|
126
|
+
exmp: 2
|
127
|
+
},
|
128
|
+
"job-poll-timeout" => {
|
129
|
+
type: Integer,
|
130
|
+
desc: "The time, in seconds, to wait for orchestrator job status.",
|
131
|
+
exmp: 2000
|
132
|
+
},
|
133
|
+
"kex-algorithms" => {
|
134
|
+
type: Array,
|
135
|
+
desc: "A list of key exchange algorithms to use when establishing a connection "\
|
136
|
+
"to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
|
137
|
+
"viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
|
138
|
+
"non-deprecated algorithms are available by default when this option is not used. To "\
|
139
|
+
"reference all default algorithms using this option, add 'defaults' to the list of "\
|
140
|
+
"supported algorithms.",
|
141
|
+
exmp: %w[defaults diffie-hellman-group1-sha1]
|
142
|
+
},
|
143
|
+
"load-config" => {
|
144
|
+
type: [TrueClass, FalseClass],
|
145
|
+
desc: "Whether to load system SSH configuration from '~/.ssh/config' and '/etc/ssh_config'.",
|
146
|
+
def: true,
|
147
|
+
exmp: false
|
148
|
+
},
|
149
|
+
"login-shell" => {
|
150
|
+
type: String,
|
151
|
+
desc: "Which login shell Bolt should expect on the target. Supported shells are " \
|
152
|
+
"#{LOGIN_SHELLS.join(', ')}. **This option is experimental.**",
|
153
|
+
def: "bash",
|
154
|
+
exmp: "powershell"
|
155
|
+
},
|
156
|
+
"mac-algorithms" => {
|
157
|
+
type: Array,
|
158
|
+
desc: "List of message authentication code algorithms to use when establishing a connection "\
|
159
|
+
"to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
|
160
|
+
"viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
|
161
|
+
"non-deprecated algorithms are available by default when this option is not used. To "\
|
162
|
+
"reference all default algorithms using this option, add 'defaults' to the list of "\
|
163
|
+
"supported algorithms.",
|
164
|
+
exmp: %w[defaults hmac-md5]
|
165
|
+
},
|
166
|
+
"password" => {
|
167
|
+
type: String,
|
168
|
+
desc: "The password to use to login.",
|
169
|
+
exmp: "hunter2!"
|
170
|
+
},
|
171
|
+
"port" => {
|
172
|
+
type: Integer,
|
173
|
+
desc: "The port to use when connecting to the target.",
|
174
|
+
exmp: 22
|
175
|
+
},
|
176
|
+
"private-key" => {
|
177
|
+
type: [Hash, String],
|
178
|
+
desc: "Either the path to the private key file to use for authentication, or "\
|
179
|
+
"a hash with the key `key-data` and the contents of the private key.",
|
180
|
+
exmp: "~/.ssh/id_rsa"
|
181
|
+
},
|
182
|
+
"proxyjump" => {
|
183
|
+
type: String,
|
184
|
+
desc: "A jump host to proxy connections through, and an optional user to connect with.",
|
185
|
+
exmp: "jump.example.com"
|
186
|
+
},
|
187
|
+
"realm" => {
|
188
|
+
type: String,
|
189
|
+
desc: "The Kerberos realm (Active Directory domain) to authenticate against.",
|
190
|
+
exmp: "BOLT.PRODUCTION"
|
191
|
+
},
|
192
|
+
"run-as" => {
|
193
|
+
type: String,
|
194
|
+
desc: "The user to run commands as after login. The run-as user must be different than the login user.",
|
195
|
+
exmp: "root"
|
196
|
+
},
|
197
|
+
"run-as-command" => {
|
198
|
+
type: Array,
|
199
|
+
desc: "The command to elevate permissions. Bolt appends the user and command strings to the configured "\
|
200
|
+
"`run-as-command` before running it on the target. This command must not require an interactive "\
|
201
|
+
"password prompt, and the `sudo-password` option is ignored when `run-as-command` is specified. "\
|
202
|
+
"The `run-as-command` must be specified as an array.",
|
203
|
+
exmp: ["sudo", "-nkSEu"]
|
204
|
+
},
|
205
|
+
"run-on" => {
|
206
|
+
type: String,
|
207
|
+
desc: "The proxy target that the task executes on.",
|
208
|
+
def: "localhost",
|
209
|
+
exmp: "proxy_target"
|
210
|
+
},
|
211
|
+
"script-dir" => {
|
212
|
+
type: String,
|
213
|
+
desc: "The subdirectory of the tmpdir to use in place of a randomized "\
|
214
|
+
"subdirectory for uploading and executing temporary files on the "\
|
215
|
+
"target. It's expected that this directory already exists as a subdir "\
|
216
|
+
"of tmpdir, which is either configured or defaults to `/tmp`.",
|
217
|
+
exmp: "bolt_scripts"
|
218
|
+
},
|
219
|
+
"service-url" => {
|
220
|
+
type: String,
|
221
|
+
desc: "The URL of the host used for API requests.",
|
222
|
+
exmp: "https://api.example.com"
|
223
|
+
},
|
224
|
+
"shell-command" => {
|
225
|
+
type: String,
|
226
|
+
desc: "A shell command to wrap any Docker exec commands in, such as `bash -lc`.",
|
227
|
+
exmp: "bash -lc"
|
228
|
+
},
|
229
|
+
"smb-port" => {
|
230
|
+
type: Integer,
|
231
|
+
desc: "The port to use when connecting to the target when file-protocol is set to 'smb'.",
|
232
|
+
exmp: 445
|
233
|
+
},
|
234
|
+
"ssh-command" => {
|
235
|
+
type: [Array, String],
|
236
|
+
desc: "The command and flags to use when SSHing. This enables the external SSH transport, which "\
|
237
|
+
"shells out to the specified command. This option is used when you need support for "\
|
238
|
+
"features or algorithms that are not supported by the net-ssh Ruby library. **This option is "\
|
239
|
+
"experimental.** You can read more about this option in [External SSH "\
|
240
|
+
"transport](experimental_features.md#external-ssh-transport).",
|
241
|
+
exmp: "ssh"
|
242
|
+
},
|
243
|
+
"ssl" => {
|
244
|
+
type: [TrueClass, FalseClass],
|
245
|
+
desc: "Whether to use secure https connections for WinRM.",
|
246
|
+
def: true,
|
247
|
+
exmp: false
|
248
|
+
},
|
249
|
+
"ssl-verify" => {
|
250
|
+
type: [TrueClass, FalseClass],
|
251
|
+
desc: "Whether to verify that the target's certificate matches the cacert.",
|
252
|
+
def: true,
|
253
|
+
exmp: false
|
254
|
+
},
|
255
|
+
"sudo-executable" => {
|
256
|
+
type: String,
|
257
|
+
desc: "The executable to use when escalating to the configured `run-as` user. This is useful when you "\
|
258
|
+
"want to escalate using the configured `sudo-password`, since `run-as-command` does not use "\
|
259
|
+
"`sudo-password` or support prompting. The command executed on the target is `<sudo-executable> "\
|
260
|
+
"-S -u <user> -p custom_bolt_prompt <command>`. **This option is experimental.**",
|
261
|
+
exmp: "dzdo"
|
262
|
+
},
|
263
|
+
"sudo-password" => {
|
264
|
+
type: String,
|
265
|
+
desc: "The password to use when changing users via `run-as`.",
|
266
|
+
exmp: "p@$$w0rd!"
|
267
|
+
},
|
268
|
+
"task-environment" => {
|
269
|
+
type: String,
|
270
|
+
desc: "The environment the orchestrator loads task code from.",
|
271
|
+
def: "production",
|
272
|
+
exmp: "development"
|
273
|
+
},
|
274
|
+
"tmpdir" => {
|
275
|
+
type: String,
|
276
|
+
desc: "The directory to upload and execute temporary files on the target.",
|
277
|
+
exmp: "/tmp/bolt"
|
278
|
+
},
|
279
|
+
"token-file" => {
|
280
|
+
type: String,
|
281
|
+
desc: "The path to the token file.",
|
282
|
+
exmp: "~/.puppetlabs/puppet/token.pem"
|
283
|
+
},
|
284
|
+
"tty" => {
|
285
|
+
type: [TrueClass, FalseClass],
|
286
|
+
desc: "Whether to enable tty on exec commands.",
|
287
|
+
exmp: true
|
288
|
+
},
|
289
|
+
"user" => {
|
290
|
+
type: String,
|
291
|
+
desc: "The user name to login as.",
|
292
|
+
exmp: "bolt"
|
293
|
+
}
|
294
|
+
}.freeze
|
295
|
+
|
296
|
+
RUN_AS_OPTIONS = %w[
|
297
|
+
run-as
|
298
|
+
run-as-command
|
299
|
+
sudo-executable
|
300
|
+
sudo-password
|
301
|
+
].freeze
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|