openbolt 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Puppetfile +1 -2
- data/lib/bolt/bolt_option_parser.rb +63 -1
- data/lib/bolt/cli.rb +1 -1
- data/lib/bolt/config/options.rb +14 -0
- data/lib/bolt/config/transport/choria.rb +74 -0
- data/lib/bolt/config/transport/options.rb +108 -0
- data/lib/bolt/executor.rb +2 -0
- data/lib/bolt/pal/yaml_plan/transpiler.rb +1 -1
- data/lib/bolt/plugin/puppetdb.rb +1 -1
- data/lib/bolt/plugin.rb +1 -4
- data/lib/bolt/puppetdb/config.rb +8 -0
- data/lib/bolt/puppetdb/instance.rb +1 -0
- data/lib/bolt/result_set.rb +1 -1
- data/lib/bolt/transport/choria/agent_discovery.rb +137 -0
- data/lib/bolt/transport/choria/bolt_tasks.rb +248 -0
- data/lib/bolt/transport/choria/client.rb +281 -0
- data/lib/bolt/transport/choria/command_builders.rb +199 -0
- data/lib/bolt/transport/choria/helpers.rb +197 -0
- data/lib/bolt/transport/choria/shell.rb +560 -0
- data/lib/bolt/transport/choria.rb +218 -0
- data/lib/bolt/transport/winrm/connection.rb +13 -3
- data/lib/bolt/version.rb +1 -1
- data/lib/mcollective/agent/shell.ddl +154 -0
- metadata +31 -10
- data/lib/bolt/plugin/puppet_connect_data.rb +0 -85
- data/modules/puppet_connect/plans/test_input_data.pp +0 -94
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# @summary
|
|
2
|
-
# Tests that the provided Puppet Connect input data is complete, meaning that all consuming inventory targets are connectable.
|
|
3
|
-
# You should run this plan with the following command:
|
|
4
|
-
# PUPPET_CONNECT_INPUT_DATA=/path/to/input_data.yaml bolt plan run puppet_connect::test_input_data
|
|
5
|
-
# where /path/to/input_data.yaml is the path to the input_data.yaml file containing the key-value input for the
|
|
6
|
-
# puppet_connect_data plugin. If the plan fails on some targets, then you can use Bolt's --rerun option to rerun the plan on
|
|
7
|
-
# just the failed targets:
|
|
8
|
-
# PUPPET_CONNECT_INPUT_DATA=/path/to/input_data.yaml bolt plan run puppet_connect::test_input_data --rerun failure
|
|
9
|
-
# Note that this plan should only be used as part of the copy-pastable "test input data" workflow specified in the Puppet
|
|
10
|
-
# Connect docs.
|
|
11
|
-
#
|
|
12
|
-
# @param targets
|
|
13
|
-
# The set of targets to test. Usually this should be 'all', the default.
|
|
14
|
-
#
|
|
15
|
-
# @return ResultSet the result of invoking the 'is connectable?' query on all
|
|
16
|
-
# the targets. Note that this query currently consists of running the 'echo'
|
|
17
|
-
# command.
|
|
18
|
-
#
|
|
19
|
-
plan puppet_connect::test_input_data(TargetSpec $targets = 'all') {
|
|
20
|
-
$targs = get_targets($targets)
|
|
21
|
-
$unique_plugins = $targs.group_by |$t| {$t.plugin_hooks['puppet_library']}
|
|
22
|
-
if ($unique_plugins.keys.length > 1) {
|
|
23
|
-
out::message('Multiple puppet_library plugin hooks detected')
|
|
24
|
-
$unique_plugins.each |$plug, $target_list| {
|
|
25
|
-
$target_message = if ($target_list.length > 10) {
|
|
26
|
-
"${target_list.length} targets"
|
|
27
|
-
} else {
|
|
28
|
-
$target_list.join(', ')
|
|
29
|
-
}
|
|
30
|
-
out::message("Plugin hook ${plug} configured for ${target_message}")
|
|
31
|
-
}
|
|
32
|
-
fail_plan("The puppet_library plugin config must be the same across all targets")
|
|
33
|
-
}
|
|
34
|
-
$targs.each |$target| {
|
|
35
|
-
case $target.transport {
|
|
36
|
-
'ssh': {
|
|
37
|
-
$private_key_config = dig($target.config, 'ssh', 'private-key')
|
|
38
|
-
if $private_key_config =~ String {
|
|
39
|
-
$msg = @("END")
|
|
40
|
-
The SSH private key of the ${$target} target points to a filepath on disk,
|
|
41
|
-
which is not allowed in Puppet Connect. Instead, the private key contents must
|
|
42
|
-
be specified and this should be done via the PuppetConnectData plugin. Below is
|
|
43
|
-
an example of a Puppet Connect-compatible specification of the private-key. First,
|
|
44
|
-
we start with the inventory file:
|
|
45
|
-
...
|
|
46
|
-
private-key:
|
|
47
|
-
_plugin: puppet_connect_data
|
|
48
|
-
key: ssh_private_key
|
|
49
|
-
...
|
|
50
|
-
|
|
51
|
-
Next is the corresponding entry in the input data file:
|
|
52
|
-
...
|
|
53
|
-
ssh_private_key:
|
|
54
|
-
key-data:
|
|
55
|
-
<private_key_contents>
|
|
56
|
-
...
|
|
57
|
-
| END
|
|
58
|
-
|
|
59
|
-
out::message($msg)
|
|
60
|
-
fail_plan("The SSH private key of the ${$target} target points to a filepath on disk")
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
# Disable SSH autoloading to prevent false positive results
|
|
64
|
-
# (input data is wrong but target is still connectable due
|
|
65
|
-
# to autoloaded config)
|
|
66
|
-
set_config($target, ['ssh', 'load-config'], false)
|
|
67
|
-
# Maintain configuration parity with Puppet Connect to improve
|
|
68
|
-
# the reliability of our test
|
|
69
|
-
set_config($target, ['ssh', 'host-key-check'], false)
|
|
70
|
-
}
|
|
71
|
-
'winrm': {
|
|
72
|
-
# Maintain configuration parity with Puppet Connect
|
|
73
|
-
set_config($target, ['winrm', 'ssl'], false)
|
|
74
|
-
set_config($target, ['winrm', 'ssl-verify'], false)
|
|
75
|
-
}
|
|
76
|
-
default: {
|
|
77
|
-
fail_plan("Inventory contains target ${target} with unsupported transport, must be ssh or winrm")
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
# OpenBolt defaults to using the "module" based form of the openvox_bootstrap plugin. Connect defaults
|
|
82
|
-
# to using the "task" based form as *only* the task based form in supported in Connect. This check
|
|
83
|
-
# ensures that if the default is not being used, only task based plugins are allowed.
|
|
84
|
-
$plugin = $target.plugin_hooks["puppet_library"]
|
|
85
|
-
$user_configured_plugin = $plugin != { "plugin"=> "openvox_bootstrap", "stop_service"=> true }
|
|
86
|
-
if ($user_configured_plugin and $plugin["plugin"] != "task"){
|
|
87
|
-
fail_plan("Only task plugins are acceptable for puppet_library hook")
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
# The SSH/WinRM transports will report an 'unknown host' error for targets where
|
|
91
|
-
# 'host' is unknown so run_command's implementation will take care of raising that
|
|
92
|
-
# error for us.
|
|
93
|
-
return run_command('echo Connected', $targs)
|
|
94
|
-
}
|