openbolt 5.0.0.rc1

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.
Files changed (258) hide show
  1. checksums.yaml +7 -0
  2. data/Puppetfile +52 -0
  3. data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +60 -0
  4. data/bolt-modules/boltlib/lib/puppet/datatypes/containerresult.rb +51 -0
  5. data/bolt-modules/boltlib/lib/puppet/datatypes/future.rb +25 -0
  6. data/bolt-modules/boltlib/lib/puppet/datatypes/resourceinstance.rb +71 -0
  7. data/bolt-modules/boltlib/lib/puppet/datatypes/result.rb +55 -0
  8. data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +65 -0
  9. data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +93 -0
  10. data/bolt-modules/boltlib/lib/puppet/functions/add_facts.rb +33 -0
  11. data/bolt-modules/boltlib/lib/puppet/functions/add_to_group.rb +38 -0
  12. data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +208 -0
  13. data/bolt-modules/boltlib/lib/puppet/functions/background.rb +62 -0
  14. data/bolt-modules/boltlib/lib/puppet/functions/catch_errors.rb +57 -0
  15. data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +130 -0
  16. data/bolt-modules/boltlib/lib/puppet/functions/facts.rb +31 -0
  17. data/bolt-modules/boltlib/lib/puppet/functions/fail_plan.rb +52 -0
  18. data/bolt-modules/boltlib/lib/puppet/functions/get_resources.rb +87 -0
  19. data/bolt-modules/boltlib/lib/puppet/functions/get_target.rb +34 -0
  20. data/bolt-modules/boltlib/lib/puppet/functions/get_targets.rb +35 -0
  21. data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +74 -0
  22. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb +97 -0
  23. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_fact.rb +47 -0
  24. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +52 -0
  25. data/bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb +40 -0
  26. data/bolt-modules/boltlib/lib/puppet/functions/resolve_references.rb +42 -0
  27. data/bolt-modules/boltlib/lib/puppet/functions/resource.rb +53 -0
  28. data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +106 -0
  29. data/bolt-modules/boltlib/lib/puppet/functions/run_container.rb +162 -0
  30. data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +291 -0
  31. data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +145 -0
  32. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +164 -0
  33. data/bolt-modules/boltlib/lib/puppet/functions/run_task_with.rb +211 -0
  34. data/bolt-modules/boltlib/lib/puppet/functions/set_config.rb +48 -0
  35. data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +43 -0
  36. data/bolt-modules/boltlib/lib/puppet/functions/set_resources.rb +145 -0
  37. data/bolt-modules/boltlib/lib/puppet/functions/set_var.rb +38 -0
  38. data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +101 -0
  39. data/bolt-modules/boltlib/lib/puppet/functions/vars.rb +29 -0
  40. data/bolt-modules/boltlib/lib/puppet/functions/wait.rb +131 -0
  41. data/bolt-modules/boltlib/lib/puppet/functions/wait_until_available.rb +59 -0
  42. data/bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb +39 -0
  43. data/bolt-modules/boltlib/lib/puppet/functions/write_file.rb +50 -0
  44. data/bolt-modules/boltlib/types/planresult.pp +18 -0
  45. data/bolt-modules/boltlib/types/targetspec.pp +7 -0
  46. data/bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb +42 -0
  47. data/bolt-modules/ctrl/lib/puppet/functions/ctrl/sleep.rb +20 -0
  48. data/bolt-modules/dir/lib/puppet/functions/dir/children.rb +35 -0
  49. data/bolt-modules/file/lib/puppet/functions/file/delete.rb +21 -0
  50. data/bolt-modules/file/lib/puppet/functions/file/exists.rb +28 -0
  51. data/bolt-modules/file/lib/puppet/functions/file/join.rb +20 -0
  52. data/bolt-modules/file/lib/puppet/functions/file/read.rb +33 -0
  53. data/bolt-modules/file/lib/puppet/functions/file/readable.rb +28 -0
  54. data/bolt-modules/file/lib/puppet/functions/file/write.rb +24 -0
  55. data/bolt-modules/log/lib/puppet/functions/log/debug.rb +39 -0
  56. data/bolt-modules/log/lib/puppet/functions/log/error.rb +40 -0
  57. data/bolt-modules/log/lib/puppet/functions/log/fatal.rb +40 -0
  58. data/bolt-modules/log/lib/puppet/functions/log/info.rb +39 -0
  59. data/bolt-modules/log/lib/puppet/functions/log/trace.rb +39 -0
  60. data/bolt-modules/log/lib/puppet/functions/log/warn.rb +41 -0
  61. data/bolt-modules/out/lib/puppet/functions/out/message.rb +36 -0
  62. data/bolt-modules/out/lib/puppet/functions/out/verbose.rb +35 -0
  63. data/bolt-modules/prompt/lib/puppet/functions/prompt/menu.rb +103 -0
  64. data/bolt-modules/prompt/lib/puppet/functions/prompt.rb +65 -0
  65. data/bolt-modules/system/lib/puppet/functions/system/env.rb +20 -0
  66. data/exe/bolt +17 -0
  67. data/guides/debugging.yaml +27 -0
  68. data/guides/inventory.yaml +23 -0
  69. data/guides/links.yaml +12 -0
  70. data/guides/logging.yaml +17 -0
  71. data/guides/module.yaml +18 -0
  72. data/guides/modulepath.yaml +24 -0
  73. data/guides/project.yaml +21 -0
  74. data/guides/targets.yaml +28 -0
  75. data/guides/transports.yaml +22 -0
  76. data/lib/bolt/analytics.rb +233 -0
  77. data/lib/bolt/application.rb +806 -0
  78. data/lib/bolt/applicator.rb +368 -0
  79. data/lib/bolt/apply_inventory.rb +93 -0
  80. data/lib/bolt/apply_result.rb +154 -0
  81. data/lib/bolt/apply_target.rb +90 -0
  82. data/lib/bolt/bolt_option_parser.rb +1226 -0
  83. data/lib/bolt/catalog/logging.rb +15 -0
  84. data/lib/bolt/catalog.rb +144 -0
  85. data/lib/bolt/cli.rb +949 -0
  86. data/lib/bolt/config/modulepath.rb +30 -0
  87. data/lib/bolt/config/options.rb +673 -0
  88. data/lib/bolt/config/transport/base.rb +133 -0
  89. data/lib/bolt/config/transport/docker.rb +34 -0
  90. data/lib/bolt/config/transport/jail.rb +33 -0
  91. data/lib/bolt/config/transport/local.rb +39 -0
  92. data/lib/bolt/config/transport/lxd.rb +34 -0
  93. data/lib/bolt/config/transport/options.rb +431 -0
  94. data/lib/bolt/config/transport/orch.rb +41 -0
  95. data/lib/bolt/config/transport/podman.rb +33 -0
  96. data/lib/bolt/config/transport/remote.rb +24 -0
  97. data/lib/bolt/config/transport/ssh.rb +138 -0
  98. data/lib/bolt/config/transport/winrm.rb +63 -0
  99. data/lib/bolt/config.rb +515 -0
  100. data/lib/bolt/container_result.rb +105 -0
  101. data/lib/bolt/error.rb +194 -0
  102. data/lib/bolt/executor.rb +539 -0
  103. data/lib/bolt/fiber_executor.rb +190 -0
  104. data/lib/bolt/inventory/group.rb +446 -0
  105. data/lib/bolt/inventory/inventory.rb +391 -0
  106. data/lib/bolt/inventory/options.rb +139 -0
  107. data/lib/bolt/inventory/target.rb +293 -0
  108. data/lib/bolt/inventory.rb +120 -0
  109. data/lib/bolt/logger.rb +252 -0
  110. data/lib/bolt/module.rb +54 -0
  111. data/lib/bolt/module_installer/installer.rb +44 -0
  112. data/lib/bolt/module_installer/puppetfile/forge_module.rb +54 -0
  113. data/lib/bolt/module_installer/puppetfile/git_module.rb +37 -0
  114. data/lib/bolt/module_installer/puppetfile/module.rb +26 -0
  115. data/lib/bolt/module_installer/puppetfile.rb +131 -0
  116. data/lib/bolt/module_installer/resolver.rb +129 -0
  117. data/lib/bolt/module_installer/specs/forge_spec.rb +91 -0
  118. data/lib/bolt/module_installer/specs/git_spec.rb +150 -0
  119. data/lib/bolt/module_installer/specs/id/base.rb +116 -0
  120. data/lib/bolt/module_installer/specs/id/gitclone.rb +120 -0
  121. data/lib/bolt/module_installer/specs/id/github.rb +90 -0
  122. data/lib/bolt/module_installer/specs/id/gitlab.rb +92 -0
  123. data/lib/bolt/module_installer/specs.rb +95 -0
  124. data/lib/bolt/module_installer.rb +208 -0
  125. data/lib/bolt/node/errors.rb +55 -0
  126. data/lib/bolt/node/output.rb +29 -0
  127. data/lib/bolt/outputter/human.rb +958 -0
  128. data/lib/bolt/outputter/json.rb +205 -0
  129. data/lib/bolt/outputter/logger.rb +76 -0
  130. data/lib/bolt/outputter/rainbow.rb +118 -0
  131. data/lib/bolt/outputter.rb +57 -0
  132. data/lib/bolt/pal/issues.rb +19 -0
  133. data/lib/bolt/pal/logging.rb +17 -0
  134. data/lib/bolt/pal/yaml_plan/evaluator.rb +83 -0
  135. data/lib/bolt/pal/yaml_plan/loader.rb +94 -0
  136. data/lib/bolt/pal/yaml_plan/parameter.rb +63 -0
  137. data/lib/bolt/pal/yaml_plan/step/command.rb +45 -0
  138. data/lib/bolt/pal/yaml_plan/step/download.rb +37 -0
  139. data/lib/bolt/pal/yaml_plan/step/eval.rb +42 -0
  140. data/lib/bolt/pal/yaml_plan/step/message.rb +31 -0
  141. data/lib/bolt/pal/yaml_plan/step/plan.rb +42 -0
  142. data/lib/bolt/pal/yaml_plan/step/resources.rb +170 -0
  143. data/lib/bolt/pal/yaml_plan/step/script.rb +62 -0
  144. data/lib/bolt/pal/yaml_plan/step/task.rb +42 -0
  145. data/lib/bolt/pal/yaml_plan/step/upload.rb +37 -0
  146. data/lib/bolt/pal/yaml_plan/step/verbose.rb +31 -0
  147. data/lib/bolt/pal/yaml_plan/step.rb +223 -0
  148. data/lib/bolt/pal/yaml_plan/transpiler.rb +90 -0
  149. data/lib/bolt/pal/yaml_plan.rb +172 -0
  150. data/lib/bolt/pal.rb +847 -0
  151. data/lib/bolt/plan_creator.rb +219 -0
  152. data/lib/bolt/plan_future.rb +86 -0
  153. data/lib/bolt/plan_result.rb +44 -0
  154. data/lib/bolt/plugin/cache.rb +76 -0
  155. data/lib/bolt/plugin/env_var.rb +54 -0
  156. data/lib/bolt/plugin/module.rb +276 -0
  157. data/lib/bolt/plugin/prompt.rb +36 -0
  158. data/lib/bolt/plugin/puppet_connect_data.rb +84 -0
  159. data/lib/bolt/plugin/puppetdb.rb +124 -0
  160. data/lib/bolt/plugin/task.rb +72 -0
  161. data/lib/bolt/plugin.rb +380 -0
  162. data/lib/bolt/project.rb +219 -0
  163. data/lib/bolt/project_manager/config_migrator.rb +113 -0
  164. data/lib/bolt/project_manager/inventory_migrator.rb +67 -0
  165. data/lib/bolt/project_manager/migrator.rb +39 -0
  166. data/lib/bolt/project_manager/module_migrator.rb +203 -0
  167. data/lib/bolt/project_manager.rb +221 -0
  168. data/lib/bolt/puppetdb/client.rb +153 -0
  169. data/lib/bolt/puppetdb/config.rb +176 -0
  170. data/lib/bolt/puppetdb/instance.rb +146 -0
  171. data/lib/bolt/puppetdb.rb +15 -0
  172. data/lib/bolt/r10k_log_proxy.rb +30 -0
  173. data/lib/bolt/rerun.rb +55 -0
  174. data/lib/bolt/resource_instance.rb +133 -0
  175. data/lib/bolt/result.rb +247 -0
  176. data/lib/bolt/result_set.rb +128 -0
  177. data/lib/bolt/shell/bash/tmpdir.rb +62 -0
  178. data/lib/bolt/shell/bash.rb +516 -0
  179. data/lib/bolt/shell/powershell/snippets.rb +181 -0
  180. data/lib/bolt/shell/powershell.rb +365 -0
  181. data/lib/bolt/shell.rb +105 -0
  182. data/lib/bolt/target.rb +174 -0
  183. data/lib/bolt/task/puppet_server.rb +27 -0
  184. data/lib/bolt/task/run.rb +55 -0
  185. data/lib/bolt/task.rb +163 -0
  186. data/lib/bolt/transport/base.rb +252 -0
  187. data/lib/bolt/transport/docker/connection.rb +150 -0
  188. data/lib/bolt/transport/docker.rb +23 -0
  189. data/lib/bolt/transport/jail/connection.rb +81 -0
  190. data/lib/bolt/transport/jail.rb +21 -0
  191. data/lib/bolt/transport/local/connection.rb +106 -0
  192. data/lib/bolt/transport/local.rb +20 -0
  193. data/lib/bolt/transport/lxd/connection.rb +115 -0
  194. data/lib/bolt/transport/lxd.rb +26 -0
  195. data/lib/bolt/transport/orch/connection.rb +111 -0
  196. data/lib/bolt/transport/orch.rb +271 -0
  197. data/lib/bolt/transport/podman/connection.rb +102 -0
  198. data/lib/bolt/transport/podman.rb +19 -0
  199. data/lib/bolt/transport/remote.rb +41 -0
  200. data/lib/bolt/transport/simple.rb +54 -0
  201. data/lib/bolt/transport/ssh/connection.rb +321 -0
  202. data/lib/bolt/transport/ssh/exec_connection.rb +140 -0
  203. data/lib/bolt/transport/ssh.rb +48 -0
  204. data/lib/bolt/transport/winrm/connection.rb +378 -0
  205. data/lib/bolt/transport/winrm.rb +33 -0
  206. data/lib/bolt/util/format.rb +68 -0
  207. data/lib/bolt/util/puppet_log_level.rb +21 -0
  208. data/lib/bolt/util.rb +465 -0
  209. data/lib/bolt/validator.rb +227 -0
  210. data/lib/bolt/version.rb +5 -0
  211. data/lib/bolt.rb +8 -0
  212. data/lib/bolt_server/acl.rb +39 -0
  213. data/lib/bolt_server/base_config.rb +112 -0
  214. data/lib/bolt_server/config.rb +64 -0
  215. data/lib/bolt_server/file_cache.rb +200 -0
  216. data/lib/bolt_server/request_error.rb +11 -0
  217. data/lib/bolt_server/schemas/action-check_node_connections.json +14 -0
  218. data/lib/bolt_server/schemas/action-run_command.json +12 -0
  219. data/lib/bolt_server/schemas/action-run_script.json +47 -0
  220. data/lib/bolt_server/schemas/action-run_task.json +20 -0
  221. data/lib/bolt_server/schemas/action-upload_file.json +47 -0
  222. data/lib/bolt_server/schemas/partials/target-any.json +10 -0
  223. data/lib/bolt_server/schemas/partials/target-ssh.json +88 -0
  224. data/lib/bolt_server/schemas/partials/target-winrm.json +67 -0
  225. data/lib/bolt_server/schemas/partials/task.json +94 -0
  226. data/lib/bolt_server/schemas/transport-ssh.json +25 -0
  227. data/lib/bolt_server/schemas/transport-winrm.json +19 -0
  228. data/lib/bolt_server/transport_app.rb +554 -0
  229. data/lib/bolt_spec/bolt_context.rb +226 -0
  230. data/lib/bolt_spec/plans/action_stubs/command_stub.rb +51 -0
  231. data/lib/bolt_spec/plans/action_stubs/download_stub.rb +66 -0
  232. data/lib/bolt_spec/plans/action_stubs/plan_stub.rb +55 -0
  233. data/lib/bolt_spec/plans/action_stubs/script_stub.rb +59 -0
  234. data/lib/bolt_spec/plans/action_stubs/task_stub.rb +57 -0
  235. data/lib/bolt_spec/plans/action_stubs/upload_stub.rb +65 -0
  236. data/lib/bolt_spec/plans/action_stubs.rb +196 -0
  237. data/lib/bolt_spec/plans/mock_executor.rb +361 -0
  238. data/lib/bolt_spec/plans/publish_stub.rb +49 -0
  239. data/lib/bolt_spec/plans.rb +190 -0
  240. data/lib/bolt_spec/run.rb +246 -0
  241. data/lib/logging_extensions/logging.rb +13 -0
  242. data/libexec/apply_catalog.rb +130 -0
  243. data/libexec/bolt_catalog +68 -0
  244. data/libexec/custom_facts.rb +63 -0
  245. data/libexec/query_resources.rb +75 -0
  246. data/modules/aggregate/lib/puppet/functions/aggregate/count.rb +21 -0
  247. data/modules/aggregate/lib/puppet/functions/aggregate/nodes.rb +22 -0
  248. data/modules/aggregate/lib/puppet/functions/aggregate/targets.rb +21 -0
  249. data/modules/aggregate/plans/count.pp +56 -0
  250. data/modules/aggregate/plans/targets.pp +56 -0
  251. data/modules/canary/lib/puppet/functions/canary/merge.rb +13 -0
  252. data/modules/canary/lib/puppet/functions/canary/random_split.rb +22 -0
  253. data/modules/canary/lib/puppet/functions/canary/skip.rb +25 -0
  254. data/modules/canary/plans/init.pp +100 -0
  255. data/modules/puppet_connect/plans/test_input_data.pp +94 -0
  256. data/modules/puppetdb_fact/plans/init.pp +20 -0
  257. data/resources/bolt_bash_completion.sh +214 -0
  258. metadata +735 -0
@@ -0,0 +1,431 @@
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
+ # Definitions used to validate config options.
10
+ # https://github.com/puppetlabs/bolt/blob/main/schemas/README.md
11
+ TRANSPORT_OPTIONS = {
12
+ "basic-auth-only" => {
13
+ type: [TrueClass, FalseClass],
14
+ description: "Whether to force basic authentication. This option is only available when using SSL.",
15
+ _plugin: true,
16
+ _default: false,
17
+ _example: true
18
+ },
19
+ "batch-mode" => {
20
+ type: [TrueClass, FalseClass],
21
+ description: "Whether to disable password querying. When set to `false`, SSH will fall back to "\
22
+ "prompting for a password if key authentication fails. This might cause Bolt to hang. "\
23
+ "To prevent Bolt from hanging, you can configure `ssh-command` to use an SSH utility "\
24
+ "such as sshpass that supports providing a password non-interactively. For more "\
25
+ "information, see [Providing a password non-interactively using "\
26
+ "`native-ssh`](troubleshooting.md#providing-a-password-non-interactively-using-native-ssh).",
27
+ _plugin: true,
28
+ _default: true,
29
+ _example: false
30
+ },
31
+ "bundled-ruby" => {
32
+ description: "Whether to use the Ruby bundled with Bolt packages for local targets.",
33
+ type: [TrueClass, FalseClass],
34
+ _plugin: false,
35
+ _example: true,
36
+ _default: true
37
+ },
38
+ "cacert" => {
39
+ type: String,
40
+ description: "The path to the CA certificate.",
41
+ _plugin: true,
42
+ _example: "~/.puppetlabs/puppet/cert.pem"
43
+ },
44
+ "cleanup" => {
45
+ type: [TrueClass, FalseClass],
46
+ description: "Whether to clean up temporary files created on targets. When running commands on a target, "\
47
+ "Bolt might create temporary files. After completing the command, these files are "\
48
+ "automatically deleted. This value can be set to 'false' if you wish to leave these "\
49
+ "temporary files on the target.",
50
+ _plugin: true,
51
+ _default: true,
52
+ _example: false
53
+ },
54
+ "connect-timeout" => {
55
+ type: Integer,
56
+ description: "How long to wait in seconds when establishing connections. Set this value higher if you "\
57
+ "frequently encounter connection timeout errors when running Bolt.",
58
+ minimum: 1,
59
+ _plugin: true,
60
+ _default: 10,
61
+ _example: 15
62
+ },
63
+ "copy-command" => {
64
+ type: [Array, String],
65
+ description: "The command to use when copying files using native SSH. Bolt runs `<copy-command> <src> "\
66
+ "<dest>`. This option is used when you need support for features or algorithms that are not "\
67
+ "supported by the net-ssh Ruby library. **This option is experimental.** You can read more "\
68
+ "about this option in [Native SSH transport](experimental_features.md#native-ssh-transport).",
69
+ items: {
70
+ type: String
71
+ },
72
+ _plugin: true,
73
+ _default: %w[scp -r],
74
+ _example: %w[scp -r -F ~/ssh-config/myconf]
75
+ },
76
+ "disconnect-timeout" => {
77
+ type: Integer,
78
+ description: "How long to wait in seconds before force-closing a connection.",
79
+ minimum: 1,
80
+ _plugin: true,
81
+ _default: 5,
82
+ _example: 10
83
+ },
84
+ "encryption-algorithms" => {
85
+ type: Array,
86
+ description: "A list of encryption algorithms to use when establishing a connection "\
87
+ "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
88
+ "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
89
+ "non-deprecated algorithms are available by default when this option is not used. To "\
90
+ "reference all default algorithms using this option, add 'defaults' to the list of "\
91
+ "supported algorithms.",
92
+ uniqueItems: true,
93
+ items: {
94
+ type: String
95
+ },
96
+ _plugin: true,
97
+ _example: %w[defaults idea-cbc]
98
+ },
99
+ "extensions" => {
100
+ type: Array,
101
+ description: "A list of file extensions that are accepted for scripts or tasks on "\
102
+ "Windows. Scripts with these file extensions rely on the target's file "\
103
+ "type association to run. For example, if Python is installed on the "\
104
+ "system, a `.py` script runs with `python.exe`. The extensions `.ps1`, "\
105
+ "`.rb`, and `.pp` are always allowed and run via hard-coded "\
106
+ "executables.",
107
+ uniqueItems: true,
108
+ items: {
109
+ type: String
110
+ },
111
+ _plugin: true,
112
+ _example: [".sh"]
113
+ },
114
+ "file-protocol" => {
115
+ type: String,
116
+ description: "Which file transfer protocol to use. Either `winrm` or `smb`. Using `smb` is "\
117
+ "recommended for large file transfers.",
118
+ enum: %w[smb winrm],
119
+ _plugin: true,
120
+ _default: "winrm",
121
+ _example: "smb"
122
+ },
123
+ "host" => {
124
+ type: String,
125
+ description: "The target's hostname.",
126
+ _plugin: true,
127
+ _example: "docker_host_production"
128
+ },
129
+ "host-key-algorithms" => {
130
+ type: Array,
131
+ description: "A list of host key algorithms to use when establishing a connection "\
132
+ "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
133
+ "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
134
+ "non-deprecated algorithms are available by default when this option is not used. To "\
135
+ "reference all default algorithms using this option, add 'defaults' to the list of "\
136
+ "supported algorithms.",
137
+ uniqueItems: true,
138
+ items: {
139
+ type: String
140
+ },
141
+ _plugin: true,
142
+ _example: %w[defaults ssh-dss]
143
+ },
144
+ "host-key-check" => {
145
+ type: [TrueClass, FalseClass],
146
+ description: "Whether to perform host key validation when connecting.",
147
+ _plugin: true,
148
+ _example: false
149
+ },
150
+ "interpreters" => {
151
+ type: Hash,
152
+ description: "A map of an extension name to the absolute path of an executable, enabling you to "\
153
+ "override the shebang defined in a task executable. The extension can optionally be "\
154
+ "specified with the `.` character (`.py` and `py` both map to a task executable "\
155
+ "`task.py`) and the extension is case sensitive. When a target's name is `localhost`, "\
156
+ "Ruby tasks run with the Bolt Ruby interpreter by default.",
157
+ additionalProperties: {
158
+ type: [String, Array],
159
+ _plugin: false
160
+ },
161
+ propertyNames: {
162
+ pattern: "^.?[a-zA-Z0-9]+$"
163
+ },
164
+ _plugin: true,
165
+ _example: { "rb" => ["/usr/bin/ruby", "-r", "puppet"],
166
+ ".py" => "/usr/bin/python3" }
167
+ },
168
+ "job-poll-interval" => {
169
+ type: Integer,
170
+ description: "The interval, in seconds, to poll orchestrator for job status.",
171
+ minimum: 1,
172
+ _plugin: true,
173
+ _example: 2
174
+ },
175
+ "job-poll-timeout" => {
176
+ type: Integer,
177
+ description: "The time, in seconds, to wait for orchestrator job status.",
178
+ minimum: 1,
179
+ _plugin: true,
180
+ _example: 2000
181
+ },
182
+ "kex-algorithms" => {
183
+ type: Array,
184
+ description: "A list of key exchange algorithms to use when establishing a connection "\
185
+ "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
186
+ "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
187
+ "non-deprecated algorithms are available by default when this option is not used. To "\
188
+ "reference all default algorithms using this option, add 'defaults' to the list of "\
189
+ "supported algorithms.",
190
+ uniqueItems: true,
191
+ items: {
192
+ type: String
193
+ },
194
+ _plugin: true,
195
+ _example: %w[defaults diffie-hellman-group1-sha1]
196
+ },
197
+ "load-config" => {
198
+ type: [TrueClass, FalseClass],
199
+ description: "Whether to load system SSH configuration from '~/.ssh/config' and '/etc/ssh_config'.",
200
+ _plugin: true,
201
+ _default: true,
202
+ _example: false
203
+ },
204
+ "login-shell" => {
205
+ type: String,
206
+ description: "Which login shell Bolt should expect on the target. Supported shells are " \
207
+ "#{LOGIN_SHELLS.join(', ')}. **This option is experimental.**",
208
+ enum: LOGIN_SHELLS,
209
+ _plugin: true,
210
+ _default: "bash",
211
+ _example: "powershell"
212
+ },
213
+ "mac-algorithms" => {
214
+ type: Array,
215
+ description: "List of message authentication code algorithms to use when establishing a connection "\
216
+ "to a target. Supported algorithms are defined by the Ruby net-ssh library and can be "\
217
+ "viewed [here](https://github.com/net-ssh/net-ssh#supported-algorithms). All supported, "\
218
+ "non-deprecated algorithms are available by default when this option is not used. To "\
219
+ "reference all default algorithms using this option, add 'defaults' to the list of "\
220
+ "supported algorithms.",
221
+ uniqueItems: true,
222
+ items: {
223
+ type: String
224
+ },
225
+ _plugin: true,
226
+ _example: %w[defaults hmac-md5]
227
+ },
228
+ "native-ssh" => {
229
+ type: [TrueClass, FalseClass],
230
+ description: "This enables the native SSH transport, which shells out to SSH instead of using the "\
231
+ "net-ssh Ruby library",
232
+ _default: false,
233
+ _example: true
234
+ },
235
+ "password" => {
236
+ type: String,
237
+ description: "The password to use to login.",
238
+ _plugin: true,
239
+ _example: "hunter2!"
240
+ },
241
+ "port" => {
242
+ type: Integer,
243
+ description: "The port to use when connecting to the target.",
244
+ minimum: 0,
245
+ _plugin: true,
246
+ _example: 22
247
+ },
248
+ "private-key" => {
249
+ type: [Hash, String],
250
+ description: "Either the path to the private key file to use for authentication, or "\
251
+ "a hash with the key `key-data` and the contents of the private key. Note that "\
252
+ "the key cannot be encrypted if using the `key-data` hash.",
253
+ required: ["key-data"],
254
+ properties: {
255
+ "key-data" => {
256
+ description: "The contents of the private key.",
257
+ type: String
258
+ }
259
+ },
260
+ _plugin: true,
261
+ _example: "~/.ssh/id_rsa"
262
+ },
263
+ "proxyjump" => {
264
+ type: String,
265
+ description: "A jump host to proxy connections through, and an optional user to connect with.",
266
+ format: "uri",
267
+ _plugin: true,
268
+ _example: "jump.example.com"
269
+ },
270
+ "read-timeout" => {
271
+ type: Integer,
272
+ description: "How long to wait in seconds when making requests to the Orchestrator.",
273
+ minimum: 1,
274
+ _plugin: true,
275
+ _example: 15
276
+ },
277
+ "realm" => {
278
+ type: String,
279
+ description: "The Kerberos realm (Active Directory domain) to authenticate against.",
280
+ _plugin: true,
281
+ _example: "BOLT.PRODUCTION"
282
+ },
283
+ "remote" => {
284
+ type: String,
285
+ description: "The LXD remote host to use.",
286
+ _default: "local",
287
+ _plugin: false,
288
+ _example: 'myremote'
289
+ },
290
+ "run-as" => {
291
+ type: String,
292
+ description: "The user to run commands as after login. The run-as user must be different than the "\
293
+ "login user.",
294
+ _plugin: true,
295
+ _example: "root"
296
+ },
297
+ "run-as-command" => {
298
+ type: Array,
299
+ description: "The command to elevate permissions. Bolt appends the user and command strings to the "\
300
+ "configured `run-as-command` before running it on the target. This command must not require "\
301
+ " aninteractive password prompt, and the `sudo-password` option is ignored when "\
302
+ "`run-as-command` is specified. The `run-as-command` must be specified as an array.",
303
+ items: {
304
+ type: String
305
+ },
306
+ _plugin: true,
307
+ _example: ["sudo", "-nkSEu"]
308
+ },
309
+ "run-on" => {
310
+ type: String,
311
+ description: "The proxy target that the task executes on.",
312
+ format: "uri",
313
+ _plugin: true,
314
+ _default: "localhost",
315
+ _example: "proxy_target"
316
+ },
317
+ "script-dir" => {
318
+ type: String,
319
+ description: "The subdirectory of the tmpdir to use in place of a randomized "\
320
+ "subdirectory for uploading and executing temporary files on the "\
321
+ "target. It's expected that this directory already exists as a subdir "\
322
+ "of tmpdir, which is either configured or defaults to `/tmp`.",
323
+ _plugin: true,
324
+ _example: "bolt_scripts"
325
+ },
326
+ "service-url" => {
327
+ type: String,
328
+ description: "The URL of the host used for API requests.",
329
+ format: "uri",
330
+ _plugin: true,
331
+ _example: "https://api.example.com:8143"
332
+ },
333
+ "shell-command" => {
334
+ type: String,
335
+ description: "A shell command to wrap any exec commands in, such as `bash -lc`.",
336
+ _plugin: true,
337
+ _example: "bash -lc"
338
+ },
339
+ "smb-port" => {
340
+ type: Integer,
341
+ description: "The port to use when connecting to the target when file-protocol is set to 'smb'.",
342
+ minimum: 0,
343
+ _plugin: true,
344
+ _example: 445
345
+ },
346
+ "ssh-command" => {
347
+ type: [Array, String],
348
+ description: "The command and options to use when SSHing. This option is used when you need support for "\
349
+ "features or algorithms that are not supported by the net-ssh Ruby library. **This option "\
350
+ "is experimental.** You can read more about this option in [Native SSH "\
351
+ "transport](experimental_features.md#native-ssh-transport).",
352
+ items: {
353
+ type: String
354
+ },
355
+ _plugin: true,
356
+ _default: 'ssh',
357
+ _example: %w[ssh -o Ciphers=chacha20-poly1305@openssh.com]
358
+ },
359
+ "ssl" => {
360
+ type: [TrueClass, FalseClass],
361
+ description: "Whether to use secure https connections for WinRM.",
362
+ _plugin: true,
363
+ _default: true,
364
+ _example: false
365
+ },
366
+ "ssl-verify" => {
367
+ type: [TrueClass, FalseClass],
368
+ description: "Whether to verify that the target's certificate matches the cacert.",
369
+ _plugin: true,
370
+ _default: true,
371
+ _example: false
372
+ },
373
+ "sudo-executable" => {
374
+ type: String,
375
+ description: "The executable to use when escalating to the configured `run-as` user. This is useful "\
376
+ "when you want to escalate using the configured `sudo-password`, since `run-as-command` "\
377
+ "does not use `sudo-password` or support prompting. The command executed on the target "\
378
+ "is `<sudo-executable> -S -u <user> -p custom_bolt_prompt <command>`. **This option is "\
379
+ "experimental.**",
380
+ _plugin: true,
381
+ _example: "dzdo"
382
+ },
383
+ "sudo-password" => {
384
+ type: String,
385
+ description: "The password to use when changing users via `run-as`.",
386
+ _plugin: true,
387
+ _example: "p@$$w0rd!"
388
+ },
389
+ "task-environment" => {
390
+ type: String,
391
+ description: "The environment the orchestrator loads task code from.",
392
+ _plugin: true,
393
+ _default: "production",
394
+ _example: "development"
395
+ },
396
+ "tmpdir" => {
397
+ type: String,
398
+ description: "The directory to upload and execute temporary files on the target.",
399
+ _plugin: true,
400
+ _example: "/tmp/bolt"
401
+ },
402
+ "token-file" => {
403
+ type: String,
404
+ description: "The path to the token file.",
405
+ _plugin: true,
406
+ _example: "~/.puppetlabs/puppet/token.pem"
407
+ },
408
+ "tty" => {
409
+ type: [TrueClass, FalseClass],
410
+ description: "Whether to enable tty on exec commands.",
411
+ _plugin: true,
412
+ _example: true
413
+ },
414
+ "user" => {
415
+ type: String,
416
+ description: "The user name to login as.",
417
+ _plugin: true,
418
+ _example: "bolt"
419
+ }
420
+ }.freeze
421
+
422
+ RUN_AS_OPTIONS = %w[
423
+ run-as
424
+ run-as-command
425
+ sudo-executable
426
+ sudo-password
427
+ ].freeze
428
+ end
429
+ end
430
+ end
431
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
+
6
+ module Bolt
7
+ class Config
8
+ module Transport
9
+ class Orch < Base
10
+ OPTIONS = %w[
11
+ cacert
12
+ host
13
+ job-poll-interval
14
+ job-poll-timeout
15
+ read-timeout
16
+ service-url
17
+ task-environment
18
+ token-file
19
+ ].freeze
20
+
21
+ DEFAULTS = {
22
+ "task-environment" => "production"
23
+ }.freeze
24
+
25
+ private def validate
26
+ super
27
+
28
+ if @config['cacert']
29
+ @config['cacert'] = File.expand_path(@config['cacert'], @project)
30
+ Bolt::Util.validate_file('cacert', @config['cacert'])
31
+ end
32
+
33
+ if @config['token-file']
34
+ @config['token-file'] = File.expand_path(@config['token-file'], @project)
35
+ Bolt::Util.validate_file('token-file', @config['token-file'])
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
+
6
+ module Bolt
7
+ class Config
8
+ module Transport
9
+ class Podman < Base
10
+ OPTIONS = %w[
11
+ cleanup
12
+ host
13
+ interpreters
14
+ shell-command
15
+ tmpdir
16
+ tty
17
+ ].concat(RUN_AS_OPTIONS).sort.freeze
18
+
19
+ DEFAULTS = {
20
+ 'cleanup' => true
21
+ }.freeze
22
+
23
+ private def validate
24
+ super
25
+
26
+ if @config['interpreters']
27
+ @config['interpreters'] = normalize_interpreters(@config['interpreters'])
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
+
6
+ module Bolt
7
+ class Config
8
+ module Transport
9
+ class Remote < Base
10
+ OPTIONS = %w[
11
+ run-on
12
+ ].freeze
13
+
14
+ DEFAULTS = {
15
+ "run-on" => "localhost"
16
+ }.freeze
17
+
18
+ private def filter(unfiltered)
19
+ unfiltered
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/config/transport/base'
5
+
6
+ module Bolt
7
+ class Config
8
+ module Transport
9
+ class SSH < Base
10
+ # Options available when using the net-ssh-based transport
11
+ OPTIONS = %w[
12
+ cleanup
13
+ connect-timeout
14
+ disconnect-timeout
15
+ encryption-algorithms
16
+ extensions
17
+ host
18
+ host-key-algorithms
19
+ host-key-check
20
+ interpreters
21
+ kex-algorithms
22
+ load-config
23
+ login-shell
24
+ mac-algorithms
25
+ password
26
+ port
27
+ private-key
28
+ proxyjump
29
+ script-dir
30
+ tmpdir
31
+ tty
32
+ user
33
+ ].concat(RUN_AS_OPTIONS).sort.freeze
34
+
35
+ # Options available when using the native ssh transport
36
+ NATIVE_OPTIONS = %w[
37
+ batch-mode
38
+ cleanup
39
+ copy-command
40
+ host
41
+ host-key-check
42
+ interpreters
43
+ native-ssh
44
+ port
45
+ private-key
46
+ script-dir
47
+ ssh-command
48
+ tmpdir
49
+ user
50
+ ].concat(RUN_AS_OPTIONS).sort.freeze
51
+
52
+ DEFAULTS = {
53
+ "batch-mode" => true,
54
+ "cleanup" => true,
55
+ "connect-timeout" => 10,
56
+ "disconnect-timeout" => 5,
57
+ "load-config" => true,
58
+ "login-shell" => 'bash',
59
+ "tty" => false
60
+ }.freeze
61
+
62
+ # The set of options available for the ssh and native ssh transports overlap, so we
63
+ # need to check which transport is used before fully initializing, otherwise options
64
+ # may not be filtered correctly.
65
+ def initialize(data = {}, project = nil)
66
+ assert_hash_or_config(data)
67
+ @native = true if data['native-ssh']
68
+ super(data, project)
69
+ end
70
+
71
+ # This method is used to filter CLI options in the Config class. This
72
+ # should include `ssh-command` so that we can later warn if the option
73
+ # is present without `native-ssh`
74
+ def self.options
75
+ %w[ssh-command native-ssh].concat(OPTIONS)
76
+ end
77
+
78
+ def self.schema
79
+ {
80
+ type: Hash,
81
+ properties: self::TRANSPORT_OPTIONS.slice(*(self::OPTIONS + self::NATIVE_OPTIONS)),
82
+ _plugin: true
83
+ }
84
+ end
85
+
86
+ private def filter(unfiltered)
87
+ # Because we filter before merging config together it's impossible to
88
+ # know whether both ssh-command *and* native-ssh will be specified
89
+ # unless they are both in the filter. However, we can't add
90
+ # ssh-command to OPTIONS since that's used for documenting available
91
+ # options. This makes it so that ssh-command is preserved so we can
92
+ # warn once all config is resolved if native-ssh isn't set.
93
+ @native ? unfiltered.slice(*NATIVE_OPTIONS) : unfiltered.slice(*self.class.options)
94
+ end
95
+
96
+ private def validate
97
+ super
98
+
99
+ if (key_opt = @config['private-key'])
100
+ if key_opt.instance_of?(String)
101
+ @config['private-key'] = File.expand_path(key_opt, @project)
102
+
103
+ # We have an explicit test for this to only warn if using net-ssh transport
104
+ Bolt::Util.validate_file('ssh key', @config['private-key']) if @config['native-ssh']
105
+ end
106
+
107
+ if key_opt.instance_of?(Hash) && @config['native-ssh']
108
+ raise Bolt::ValidationError, 'private-key must be a filepath when using native-ssh'
109
+ end
110
+ end
111
+
112
+ if @config['interpreters']
113
+ @config['interpreters'] = normalize_interpreters(@config['interpreters'])
114
+ end
115
+
116
+ if @config['login-shell'] == 'powershell'
117
+ %w[tty run-as].each do |key|
118
+ if @config[key]
119
+ raise Bolt::ValidationError,
120
+ "#{key} is not supported when using PowerShell"
121
+ end
122
+ end
123
+ end
124
+
125
+ if @config['native-ssh'] && !@config['load-config']
126
+ msg = 'Cannot use native SSH transport with load-config set to false'
127
+ raise Bolt::ValidationError, msg
128
+ end
129
+
130
+ if !@config['batch-mode'] && !@config['ssh-command']
131
+ raise Bolt::ValidationError,
132
+ 'Must set ssh-command when batch-mode is set to false'
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end