hybrid_platforms_conductor 32.12.0 → 32.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1103 -0
- data/LICENSE.md +31 -0
- data/README.md +395 -0
- data/bin/setup +1 -1
- data/docs/api.md +349 -0
- data/docs/config_dsl.md +315 -0
- data/docs/executables.md +226 -0
- data/docs/executables/check-node.md +155 -0
- data/docs/executables/deploy.md +198 -0
- data/docs/executables/dump_nodes_json.md +110 -0
- data/docs/executables/free_ips.md +93 -0
- data/docs/executables/free_veids.md +73 -0
- data/docs/executables/get_impacted_nodes.md +94 -0
- data/docs/executables/last_deploys.md +114 -0
- data/docs/executables/nodes_to_deploy.md +139 -0
- data/docs/executables/report.md +159 -0
- data/docs/executables/run.md +126 -0
- data/docs/executables/setup.md +92 -0
- data/docs/executables/ssh_config.md +151 -0
- data/docs/executables/test.md +213 -0
- data/docs/executables/topograph.md +139 -0
- data/docs/gen/mermaid/README.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_veids.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/setup.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
- data/docs/install.md +161 -0
- data/docs/plugins.md +215 -0
- data/docs/plugins/action/bash.md +37 -0
- data/docs/plugins/action/interactive.md +37 -0
- data/docs/plugins/action/remote_bash.md +67 -0
- data/docs/plugins/action/ruby.md +69 -0
- data/docs/plugins/action/scp.md +61 -0
- data/docs/plugins/cmdb/config.md +46 -0
- data/docs/plugins/cmdb/host_ip.md +33 -0
- data/docs/plugins/cmdb/host_keys.md +33 -0
- data/docs/plugins/cmdb/platform_handlers.md +33 -0
- data/docs/plugins/connector/local.md +28 -0
- data/docs/plugins/connector/ssh.md +95 -0
- data/docs/plugins/platform_handler/yaml_inventory.md +105 -0
- data/docs/plugins/provisioner/docker.md +27 -0
- data/docs/plugins/provisioner/podman.md +27 -0
- data/docs/plugins/provisioner/proxmox.md +115 -0
- data/docs/plugins/report/confluence.md +49 -0
- data/docs/plugins/report/mediawiki.md +28 -0
- data/docs/plugins/report/stdout.md +32 -0
- data/docs/plugins/test/bitbucket_conf.md +97 -0
- data/docs/plugins/test/can_be_checked.md +27 -0
- data/docs/plugins/test/check_deploy_and_idempotence.md +61 -0
- data/docs/plugins/test/check_from_scratch.md +28 -0
- data/docs/plugins/test/connection.md +27 -0
- data/docs/plugins/test/deploy_freshness.md +27 -0
- data/docs/plugins/test/deploy_from_scratch.md +28 -0
- data/docs/plugins/test/deploy_removes_root_access.md +29 -0
- data/docs/plugins/test/divergence.md +41 -0
- data/docs/plugins/test/executables.md +26 -0
- data/docs/plugins/test/file_system.md +49 -0
- data/docs/plugins/test/file_system_hdfs.md +65 -0
- data/docs/plugins/test/hostname.md +27 -0
- data/docs/plugins/test/idempotence.md +56 -0
- data/docs/plugins/test/ip.md +28 -0
- data/docs/plugins/test/jenkins_ci_conf.md +54 -0
- data/docs/plugins/test/jenkins_ci_masters_ok.md +54 -0
- data/docs/plugins/test/linear_strategy.md +26 -0
- data/docs/plugins/test/local_users.md +48 -0
- data/docs/plugins/test/mounts.md +55 -0
- data/docs/plugins/test/orphan_files.md +38 -0
- data/docs/plugins/test/ports.md +50 -0
- data/docs/plugins/test/private_ips.md +27 -0
- data/docs/plugins/test/public_ips.md +27 -0
- data/docs/plugins/test/spectre.md +26 -0
- data/docs/plugins/test/veids.md +27 -0
- data/docs/plugins/test/vulnerabilities.md +65 -0
- data/docs/plugins/test_report/confluence.md +43 -0
- data/docs/plugins/test_report/stdout.md +26 -0
- data/docs/plugins_create.md +135 -0
- data/docs/tutorial.md +57 -0
- data/docs/tutorial/01_installation.md +129 -0
- data/docs/tutorial/02_first_node.md +466 -0
- data/docs/tutorial/03_scale.md +876 -0
- data/docs/tutorial/04_test.md +965 -0
- data/docs/tutorial/05_extend_with_plugins.md +1132 -0
- data/examples/bare/Gemfile +4 -0
- data/examples/bare/hpc_config.rb +2 -0
- data/examples/localhost/Gemfile +4 -0
- data/examples/localhost/hpc_config.rb +2 -0
- data/examples/localhost/inventory.yaml +4 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +1 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +3 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +29 -13
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +98 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +7 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +140 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +5 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +4 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +19 -17
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +3 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +4 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +8 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +1 -1
- data/lib/hybrid_platforms_conductor/json_dumper.rb +1 -1
- data/lib/hybrid_platforms_conductor/platform_handler.rb +1 -1
- data/lib/hybrid_platforms_conductor/services_handler.rb +18 -16
- data/lib/hybrid_platforms_conductor/tests_runner.rb +0 -1
- data/lib/hybrid_platforms_conductor/topographer.rb +0 -1
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +16 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +113 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +6 -2
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +38 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/docs_spec.rb +10 -0
- data/tools/check_md +89 -0
- data/tools/generate_mermaid +75 -0
- metadata +207 -12
data/docs/plugins.md
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
# Plugins
|
2
|
+
|
3
|
+
Hybrid Platforms Conductor ships with plenty of plugins of any type. The type of the plugin is defined by the directory in which the plugin is encountered.
|
4
|
+
|
5
|
+
Check [how to create plugins](plugins_create.md) to know how to add your own plugins to this list.
|
6
|
+
|
7
|
+
Following are all possible plugin types and the plugins shipped by default with Hybrid Platforms Conductor.
|
8
|
+
|
9
|
+
# Table of Contents
|
10
|
+
* [`action`](#action)
|
11
|
+
* [`cmdb`](#cmdb)
|
12
|
+
* [`connector`](#connector)
|
13
|
+
* [`platform_handler`](#platform_handler)
|
14
|
+
* [`provisioner`](#provisioner)
|
15
|
+
* [`report`](#report)
|
16
|
+
* [`test`](#test)
|
17
|
+
* [`test_report`](#test_report)
|
18
|
+
|
19
|
+
<a name="action"></a>
|
20
|
+
## Actions
|
21
|
+
|
22
|
+
Define the kind of actions that can be executed by various processes.
|
23
|
+
|
24
|
+
Corresponding plugin type: `action`.
|
25
|
+
|
26
|
+
These plugins are meant to define new action types that can be used by the [`ActionsExecutor`](../lib/hybrid_platforms_conductor/actions_executor.rb).
|
27
|
+
|
28
|
+
Examples of actions are:
|
29
|
+
* Remote bash: Execute remote bash on the node
|
30
|
+
* Ruby: Execute Ruby code
|
31
|
+
|
32
|
+
Check the [sample plugin file](../lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample) to know more about the API that needs to be implemented by such plugins.
|
33
|
+
|
34
|
+
Plugins shipped by default:
|
35
|
+
* [`bash`](plugins/action/bash.md)
|
36
|
+
* [`interactive`](plugins/action/interactive.md)
|
37
|
+
* [`remote_bash`](plugins/action/remote_bash.md)
|
38
|
+
* [`ruby`](plugins/action/ruby.md)
|
39
|
+
* [`scp`](plugins/action/scp.md)
|
40
|
+
|
41
|
+
<a name="cmdb"></a>
|
42
|
+
## CMDBs
|
43
|
+
|
44
|
+
Retrieve nodes' metadata from various sources.
|
45
|
+
|
46
|
+
Corresponding plugin type: `cmdb`.
|
47
|
+
|
48
|
+
These plugins allow to retrieve metadata associated to a node, returned by the [`NodesHandler`](../lib/hybrid_platforms_conductor/nodes_handler.rb). New plugins can be used to retrieve new properties that can then be used by Hybrid Platforms Conductor.
|
49
|
+
|
50
|
+
Examples of CMDBs are:
|
51
|
+
* Host keys: Get host keys associated to nodes
|
52
|
+
* Host IPs: Get a node's host IP
|
53
|
+
|
54
|
+
Check the [sample plugin file](../lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample) to know more about the API that needs to be implemented by such plugins.
|
55
|
+
|
56
|
+
Plugins shipped by default:
|
57
|
+
* [`config`](plugins/cmdb/config.md)
|
58
|
+
* [`host_ip`](plugins/cmdb/host_ip.md)
|
59
|
+
* [`host_keys`](plugins/cmdb/host_keys.md)
|
60
|
+
* [`platform_handlers`](plugins/cmdb/platform_handlers.md)
|
61
|
+
|
62
|
+
<a name="connector"></a>
|
63
|
+
## Connectors
|
64
|
+
|
65
|
+
Give a way to execute remote bash or transfer files to nodes.
|
66
|
+
|
67
|
+
Corresponding plugin type: `connector`.
|
68
|
+
|
69
|
+
These plugins give ways for the [`ActionsExecutor`](../lib/hybrid_platforms_conductor/actions_executor.rb) to connect to nodes when some actions require it (like the remote code executions for example).
|
70
|
+
|
71
|
+
Examples of connectors are:
|
72
|
+
* SSH: Connect to a node using SSH
|
73
|
+
* Docker: Connect using a Docker socket
|
74
|
+
* awscli: Connect using awscli
|
75
|
+
|
76
|
+
Check the [sample plugin file](../lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample) to know more about the API that needs to be implemented by such plugins.
|
77
|
+
|
78
|
+
Plugins shipped by default:
|
79
|
+
* [`local`](plugins/connector/local.md)
|
80
|
+
* [`ssh`](plugins/connector/ssh.md)
|
81
|
+
|
82
|
+
<a name="platform_handler"></a>
|
83
|
+
## Platform Handlers
|
84
|
+
|
85
|
+
Handle repositories of nodes' inventory and services to be deployed.
|
86
|
+
|
87
|
+
Corresponding plugin type: `platform_handler`.
|
88
|
+
|
89
|
+
These plugins are used to support different types of platforms' repositories, returned by the [`NodesHandler`](../lib/hybrid_platforms_conductor/nodes_handler.rb)
|
90
|
+
|
91
|
+
Platforms are registered in the `./hpc_config.rb` file of your project.
|
92
|
+
|
93
|
+
Example from a locally checked out platform:
|
94
|
+
```ruby
|
95
|
+
<platform_type_name>_platform path: '/path/to/platform/to_be_handled_by_your_plugin'
|
96
|
+
```
|
97
|
+
|
98
|
+
Example from a platform present in a Git repository:
|
99
|
+
```ruby
|
100
|
+
<platform_type_name>_platform git: '<git_url_to_the_platform_code>'
|
101
|
+
```
|
102
|
+
|
103
|
+
Examples of platform handlers are:
|
104
|
+
* Chef: Handle a platform using Chef
|
105
|
+
* Ansible: Handle a platform using Ansible
|
106
|
+
|
107
|
+
Check the [sample plugin file](../lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample) to know more about the API that needs to be implemented by such plugins.
|
108
|
+
|
109
|
+
Plugins shipped by default:
|
110
|
+
* [`yaml_inventory`](plugins/platform_handler/yaml_inventory.md)
|
111
|
+
|
112
|
+
<a name="provisioner"></a>
|
113
|
+
## Provisioners
|
114
|
+
|
115
|
+
Give a way to provision new nodes.
|
116
|
+
|
117
|
+
Corresponding plugin type: `provisioner`.
|
118
|
+
|
119
|
+
These plugins add new ways to provision infrastructure, used by the [`Deployer`](../lib/hybrid_platforms_conductor/deployer.rb)
|
120
|
+
|
121
|
+
Examples of provisioners are:
|
122
|
+
* Docker: Provision Docker containers
|
123
|
+
* Podman: Provision Podman pods
|
124
|
+
* Terraform: Provision nodes through Terraform
|
125
|
+
* Proxmox: Provision containers or VMs using Proxmox
|
126
|
+
|
127
|
+
Check the [sample plugin file](../lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample) to know more about the API that needs to be implemented by such plugins.
|
128
|
+
|
129
|
+
Plugins shipped by default:
|
130
|
+
* [`docker`](plugins/provisioner/docker.md)
|
131
|
+
* [`podman`](plugins/provisioner/podman.md)
|
132
|
+
* [`proxmox`](plugins/provisioner/proxmox.md)
|
133
|
+
|
134
|
+
<a name="report"></a>
|
135
|
+
## Reports
|
136
|
+
|
137
|
+
Report inventory and metadata information.
|
138
|
+
|
139
|
+
Corresponding plugin type: `report`.
|
140
|
+
|
141
|
+
These plugins add new ways to publish inventory reports produced by the [`ReportsHandler`](../lib/hybrid_platforms_conductor/reports_handler.rb)
|
142
|
+
|
143
|
+
Examples of reports are:
|
144
|
+
* stdout: Just dump inventory on stdout
|
145
|
+
* Mediawiki: Dump inventory in a Mediawiki page
|
146
|
+
|
147
|
+
Check the [sample plugin file](../lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample) to know more about the API that needs to be implemented by such plugins.
|
148
|
+
|
149
|
+
Plugins shipped by default:
|
150
|
+
* [`confluence`](plugins/report/confluence.md)
|
151
|
+
* [`mediawiki`](plugins/report/mediawiki.md)
|
152
|
+
* [`stdout`](plugins/report/stdout.md)
|
153
|
+
|
154
|
+
<a name="test"></a>
|
155
|
+
## Tests
|
156
|
+
|
157
|
+
Perform various tests, on nodes, on platform repositories, and global ones as well.
|
158
|
+
|
159
|
+
Corresponding plugin type: `test`.
|
160
|
+
|
161
|
+
These plugins add available tests to the [`TestsRunner`](../lib/hybrid_platforms_conductor/tests_runner.rb).
|
162
|
+
Depending on the API they implement, they can define tests at global level, at platform level or at node level.
|
163
|
+
|
164
|
+
Examples of tests are:
|
165
|
+
* Spectre: Test a node against Spectre vulnerability
|
166
|
+
* Executables: Test that executables run without errors
|
167
|
+
* Divergence: Test that a node has not diverged from the configuration stored in its platform handler
|
168
|
+
|
169
|
+
Check the [sample plugin file](../lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample) to know more about the API that needs to be implemented by such plugins.
|
170
|
+
|
171
|
+
Plugins shipped by default:
|
172
|
+
* [`bitbucket_conf`](plugins/test/bitbucket_conf.md)
|
173
|
+
* [`can_be_checked`](plugins/test/can_be_checked.md)
|
174
|
+
* [`check_deploy_and_idempotence`](plugins/test/check_deploy_and_idempotence.md)
|
175
|
+
* [`check_from_scratch`](plugins/test/check_from_scratch.md)
|
176
|
+
* [`connection`](plugins/test/connection.md)
|
177
|
+
* [`deploy_freshness`](plugins/test/deploy_freshness.md)
|
178
|
+
* [`deploy_from_scratch`](plugins/test/deploy_from_scratch.md)
|
179
|
+
* [`deploy_removes_root_access`](plugins/test/deploy_removes_root_access.md)
|
180
|
+
* [`divergence`](plugins/test/divergence.md)
|
181
|
+
* [`executables`](plugins/test/executables.md)
|
182
|
+
* [`file_system_hdfs`](plugins/test/file_system_hdfs.md)
|
183
|
+
* [`file_system`](plugins/test/file_system.md)
|
184
|
+
* [`hostname`](plugins/test/hostname.md)
|
185
|
+
* [`idempotence`](plugins/test/idempotence.md)
|
186
|
+
* [`ip`](plugins/test/ip.md)
|
187
|
+
* [`jenkins_ci_conf`](plugins/test/jenkins_ci_conf.md)
|
188
|
+
* [`jenkins_ci_masters_ok`](plugins/test/jenkins_ci_masters_ok.md)
|
189
|
+
* [`linear_strategy`](plugins/test/linear_strategy.md)
|
190
|
+
* [`local_users`](plugins/test/local_users.md)
|
191
|
+
* [`mounts`](plugins/test/mounts.md)
|
192
|
+
* [`orphan_files`](plugins/test/orphan_files.md)
|
193
|
+
* [`ports`](plugins/test/ports.md)
|
194
|
+
* [`private_ips`](plugins/test/private_ips.md)
|
195
|
+
* [`public_ips`](plugins/test/public_ips.md)
|
196
|
+
* [`spectre`](plugins/test/spectre.md)
|
197
|
+
* [`veids`](plugins/test/veids.md)
|
198
|
+
* [`vulnerabilities`](plugins/test/vulnerabilities.md)
|
199
|
+
|
200
|
+
<a name="test_report"></a>
|
201
|
+
## Test reports
|
202
|
+
|
203
|
+
Report testing results on various mediums.
|
204
|
+
|
205
|
+
Corresponding plugin type: `test_report`.
|
206
|
+
|
207
|
+
These plugins add new ways to publish tests reports, done by the [`TestsRunner`](../lib/hybrid_platforms_conductor/tests_runner.rb).
|
208
|
+
|
209
|
+
Examples of tests reports are:
|
210
|
+
* stdout: Just dump tests results on stdout
|
211
|
+
* Confluence: Dump tests reports in a Confluence page
|
212
|
+
|
213
|
+
Plugins shipped by default:
|
214
|
+
* [`confluence`](plugins/test_report/confluence.md)
|
215
|
+
* [`stdout`](plugins/test_report/stdout.md)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Action plugin: `bash`
|
2
|
+
|
3
|
+
The `bash` action plugin executes a bash command.
|
4
|
+
It takes a simple `String` as parameter that will be executed in a local bash shell.
|
5
|
+
|
6
|
+
Exit status, stdout and stderr of the execution can be accessed as a result of the call.
|
7
|
+
|
8
|
+
Example:
|
9
|
+
```ruby
|
10
|
+
require 'hybrid_platforms_conductor/executable'
|
11
|
+
|
12
|
+
HybridPlatformsConductor::Executable.new.actions_executor.execute_actions('my_node' => { bash: 'hostname' })
|
13
|
+
# => { 'my_node' => [0, "my_hostname\n", '' ] }
|
14
|
+
```
|
15
|
+
|
16
|
+
## Config DSL extension
|
17
|
+
|
18
|
+
None
|
19
|
+
|
20
|
+
## Used credentials
|
21
|
+
|
22
|
+
| Credential | Usage
|
23
|
+
| --- | --- |
|
24
|
+
|
25
|
+
## Used Metadata
|
26
|
+
|
27
|
+
| Metadata | Type | Usage
|
28
|
+
| --- | --- | --- |
|
29
|
+
|
30
|
+
## Used environment variables
|
31
|
+
|
32
|
+
| Variable | Usage
|
33
|
+
| --- | --- |
|
34
|
+
|
35
|
+
## External tools dependencies
|
36
|
+
|
37
|
+
None
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Action plugin: `interactive`
|
2
|
+
|
3
|
+
The `interactive` action plugin executes an interactive shell on a node (using a [connector](../connector)).
|
4
|
+
It takes no argument, so any value will do (`nil`, `true`...)
|
5
|
+
|
6
|
+
Example:
|
7
|
+
```ruby
|
8
|
+
require 'hybrid_platforms_conductor/executable'
|
9
|
+
|
10
|
+
actions_executor = HybridPlatformsConductor::Executable.new.actions_executor
|
11
|
+
|
12
|
+
# Launch an interactive shell
|
13
|
+
actions_executor.execute_actions('my_node' => { interactive: true })
|
14
|
+
```
|
15
|
+
|
16
|
+
## Config DSL extension
|
17
|
+
|
18
|
+
None
|
19
|
+
|
20
|
+
## Used credentials
|
21
|
+
|
22
|
+
| Credential | Usage
|
23
|
+
| --- | --- |
|
24
|
+
|
25
|
+
## Used Metadata
|
26
|
+
|
27
|
+
| Metadata | Type | Usage
|
28
|
+
| --- | --- | --- |
|
29
|
+
|
30
|
+
## Used environment variables
|
31
|
+
|
32
|
+
| Variable | Usage
|
33
|
+
| --- | --- |
|
34
|
+
|
35
|
+
## External tools dependencies
|
36
|
+
|
37
|
+
None
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Action plugin: `remote_bash`
|
2
|
+
|
3
|
+
The `remote_bash` action plugin executes bash commands on a node (using a [connector](../connector)).
|
4
|
+
It takes various kinds of arguments:
|
5
|
+
* `String`: The bash command to execute.
|
6
|
+
* `Array<String>`: A list of bash commands to execute, sequentially.
|
7
|
+
* `Hash<Symbol, Object>`: A hash of properties describing the commands to execute in detail:
|
8
|
+
* **commands** (`Array<String>` or `String`): List of bash commands to execute (can be a single one). This is the default property also that allows to not use the Hash form for brevity.
|
9
|
+
* **file** (`String`): Name of a file from which commands should be taken.
|
10
|
+
* **env** (`Hash<String, String>`): Environment variables to be set before executing those commands.
|
11
|
+
|
12
|
+
Exit status, stdout and stderr of the execution can be accessed as a result of the call.
|
13
|
+
|
14
|
+
Example:
|
15
|
+
```ruby
|
16
|
+
require 'hybrid_platforms_conductor/executable'
|
17
|
+
|
18
|
+
actions_executor = HybridPlatformsConductor::Executable.new.actions_executor
|
19
|
+
|
20
|
+
# Execute 1 command on the node
|
21
|
+
actions_executor.execute_actions('my_node' => { remote_bash: 'hostname' })
|
22
|
+
# => { 'my_node' => [0, "my_node\n", '' ] }
|
23
|
+
# In case of connection error:
|
24
|
+
# => { 'my_node' => [:connection_error, '', 'Unable to get a connector to my_node'] }
|
25
|
+
|
26
|
+
# Execute several commands
|
27
|
+
actions_executor.execute_actions('my_node' => { remote_bash: [
|
28
|
+
'echo Hello',
|
29
|
+
'hostname',
|
30
|
+
'ls'
|
31
|
+
]})
|
32
|
+
|
33
|
+
# Execute commands from a file
|
34
|
+
actions_executor.execute_actions('my_node' => { remote_bash: { file: '/path/to/my/file.cmds' } })
|
35
|
+
|
36
|
+
# Execute commands with environment variables set
|
37
|
+
actions_executor.execute_actions('my_node' => { remote_bash: {
|
38
|
+
commands: 'echo Hello ${world}',
|
39
|
+
env: {
|
40
|
+
'world' => 'my World'
|
41
|
+
}
|
42
|
+
} })
|
43
|
+
|
44
|
+
```
|
45
|
+
|
46
|
+
## Config DSL extension
|
47
|
+
|
48
|
+
None
|
49
|
+
|
50
|
+
## Used credentials
|
51
|
+
|
52
|
+
| Credential | Usage
|
53
|
+
| --- | --- |
|
54
|
+
|
55
|
+
## Used Metadata
|
56
|
+
|
57
|
+
| Metadata | Type | Usage
|
58
|
+
| --- | --- | --- |
|
59
|
+
|
60
|
+
## Used environment variables
|
61
|
+
|
62
|
+
| Variable | Usage
|
63
|
+
| --- | --- |
|
64
|
+
|
65
|
+
## External tools dependencies
|
66
|
+
|
67
|
+
None
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Action plugin: `ruby`
|
2
|
+
|
3
|
+
The `ruby` action plugin executes Ruby code.
|
4
|
+
It takes various kinds of arguments:
|
5
|
+
* `Proc`: The Ruby block to execute
|
6
|
+
* `Hash<Symbol, Object>`: A hash of properties describing how Ruby code is to be executed:
|
7
|
+
* **code** (`Proc`): Ruby code to be executed. This is the default property, and can be given directly without using a Hash.
|
8
|
+
* **need_remote** (`Boolean`): Do we need a remote connection to the node for this code to run? [default = false]
|
9
|
+
|
10
|
+
The Ruby code block has the following signature:
|
11
|
+
* **stdout** (`IO`): Stream in which stdout of this action should be written.
|
12
|
+
* **stderr** (`IO`): Stream in which stderr of this action should be written.
|
13
|
+
* **action** (`Action`): Action we can use to access other context-specific methods, such as run_cmd.
|
14
|
+
* **connector** (`Connector` or `nil`): The connector to the node, or nil if none.
|
15
|
+
|
16
|
+
Example:
|
17
|
+
```ruby
|
18
|
+
require 'hybrid_platforms_conductor/executable'
|
19
|
+
|
20
|
+
actions_executor = HybridPlatformsConductor::Executable.new.actions_executor
|
21
|
+
|
22
|
+
# Execute a simple Ruby block
|
23
|
+
actions_executor.execute_actions('my_node' => { ruby: proc do
|
24
|
+
puts 'Hello'
|
25
|
+
end })
|
26
|
+
# => Hello
|
27
|
+
|
28
|
+
# Execute a Ruby block that logs on stdout and stderr (those are returned by the action execution)
|
29
|
+
actions_executor.execute_actions('my_node' => { ruby: proc do |stdout, stderr|
|
30
|
+
stdout << 'Hello'
|
31
|
+
stderr << 'Hello on stderr'
|
32
|
+
end })
|
33
|
+
# => { 'my_node' => [0, 'Hello', 'Hello on stderr'] }
|
34
|
+
|
35
|
+
# Execute a Ruby block that needs a connection to the node, and uses it
|
36
|
+
actions_executor.execute_actions('my_node' => { ruby: {
|
37
|
+
code: proc do |stdout, stderr, action, connector|
|
38
|
+
# If we are connecting to my_node using SSH, change the user
|
39
|
+
if connector.is_a?(HybridPlatformsConductor::HpcPlugins::Connector::Ssh)
|
40
|
+
stdout << "The SSH user is #{connector.ssh_user}"
|
41
|
+
end
|
42
|
+
end,
|
43
|
+
need_remote: true
|
44
|
+
} })
|
45
|
+
# => { 'my_node' => [0, 'The SSH user is my_remote_user', ''] }
|
46
|
+
```
|
47
|
+
|
48
|
+
## Config DSL extension
|
49
|
+
|
50
|
+
None
|
51
|
+
|
52
|
+
## Used credentials
|
53
|
+
|
54
|
+
| Credential | Usage
|
55
|
+
| --- | --- |
|
56
|
+
|
57
|
+
## Used Metadata
|
58
|
+
|
59
|
+
| Metadata | Type | Usage
|
60
|
+
| --- | --- | --- |
|
61
|
+
|
62
|
+
## Used environment variables
|
63
|
+
|
64
|
+
| Variable | Usage
|
65
|
+
| --- | --- |
|
66
|
+
|
67
|
+
## External tools dependencies
|
68
|
+
|
69
|
+
None
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Action plugin: `scp`
|
2
|
+
|
3
|
+
The `scp` action plugin transfers a local file to a remote node (using a [connector](../connector)).
|
4
|
+
It takes a `Hash` as argument, as a set of source => destination_dir to copy files or directories from the local file system to the remote file system.
|
5
|
+
The hash can also contain the following properties:
|
6
|
+
* **sudo** (`Boolean`): Do we use sudo on the remote to make the copy? [default: false]
|
7
|
+
* **owner** (`String` or `nil`): Owner to use for files, or nil to use current one [default: nil]
|
8
|
+
* **group** (`String` or `nil`): Group to use for files, or nil to use current one [default: nil]
|
9
|
+
|
10
|
+
Example:
|
11
|
+
```ruby
|
12
|
+
require 'hybrid_platforms_conductor/executable'
|
13
|
+
|
14
|
+
actions_executor = HybridPlatformsConductor::Executable.new.actions_executor
|
15
|
+
|
16
|
+
# Copy 1 file
|
17
|
+
actions_executor.execute_actions('my_node' => { scp: { '/path/to/file' => '/path/to/remote_dir' } })
|
18
|
+
|
19
|
+
# Copy several files
|
20
|
+
actions_executor.execute_actions('my_node' => { scp: {
|
21
|
+
'/path/to/file1' => '/path/to/remote_dir1',
|
22
|
+
'/path/to/file2' => '/path/to/remote_dir1',
|
23
|
+
'/path/to/file1' => '/path/to/remote_dir2',
|
24
|
+
} })
|
25
|
+
|
26
|
+
# Copy a file using sudo on my_node
|
27
|
+
actions_executor.execute_actions('my_node' => { scp: {
|
28
|
+
'/path/to/file' => '/path/to/remote_dir',
|
29
|
+
sudo: true
|
30
|
+
} })
|
31
|
+
|
32
|
+
# Copy a file and set it as a specific owner and group on my_node
|
33
|
+
actions_executor.execute_actions('my_node' => { scp: {
|
34
|
+
'/path/to/file' => '/path/to/remote_dir',
|
35
|
+
owner: 'remote_user',
|
36
|
+
group: 'remote_group'
|
37
|
+
} })
|
38
|
+
```
|
39
|
+
|
40
|
+
## Config DSL extension
|
41
|
+
|
42
|
+
None
|
43
|
+
|
44
|
+
## Used credentials
|
45
|
+
|
46
|
+
| Credential | Usage
|
47
|
+
| --- | --- |
|
48
|
+
|
49
|
+
## Used Metadata
|
50
|
+
|
51
|
+
| Metadata | Type | Usage
|
52
|
+
| --- | --- | --- |
|
53
|
+
|
54
|
+
## Used environment variables
|
55
|
+
|
56
|
+
| Variable | Usage
|
57
|
+
| --- | --- |
|
58
|
+
|
59
|
+
## External tools dependencies
|
60
|
+
|
61
|
+
None
|