hybrid_platforms_conductor 32.11.2 → 32.13.3
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/CHANGELOG.md +1121 -0
- data/LICENSE.md +31 -0
- data/README.md +402 -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 +61 -0
- data/docs/tutorial/01_installation.md +131 -0
- data/docs/tutorial/02_first_node.md +468 -0
- data/docs/tutorial/03_scale.md +878 -0
- data/docs/tutorial/04_test.md +977 -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/examples/tutorial/01_installation/my-platforms/Gemfile +3 -0
- data/examples/tutorial/01_installation/my-platforms/hpc_config.rb +0 -0
- data/examples/tutorial/02_first_node/my-platforms/Gemfile +3 -0
- data/examples/tutorial/02_first_node/my-platforms/hpc_config.rb +1 -0
- data/examples/tutorial/02_first_node/my-service-conf-repo/inventory.yaml +13 -0
- data/examples/tutorial/02_first_node/my-service-conf-repo/my-service.conf.erb +3 -0
- data/examples/tutorial/02_first_node/my-service-conf-repo/service_my-service.rb +58 -0
- data/examples/tutorial/02_first_node/node/my-service.conf +4 -0
- data/examples/tutorial/03_scale/my-platforms/Gemfile +3 -0
- data/examples/tutorial/03_scale/my-platforms/hpc_config.rb +1 -0
- data/examples/tutorial/03_scale/my-platforms/my_commands.bash +2 -0
- data/examples/tutorial/03_scale/my-service-conf-repo/inventory.yaml +90 -0
- data/examples/tutorial/03_scale/my-service-conf-repo/my-service.conf.erb +3 -0
- data/examples/tutorial/03_scale/my-service-conf-repo/service_my-service.rb +58 -0
- data/examples/tutorial/03_scale/my-service-conf-repo/service_web-hello.rb +43 -0
- data/examples/tutorial/03_scale/node/my-service.conf +4 -0
- data/examples/tutorial/03_scale/web_docker_image/Dockerfile +33 -0
- data/examples/tutorial/03_scale/web_docker_image/hello_world.txt +1 -0
- data/examples/tutorial/03_scale/web_docker_image/hpc_root.key +27 -0
- data/examples/tutorial/03_scale/web_docker_image/hpc_root.key.pub +1 -0
- data/examples/tutorial/03_scale/web_docker_image/main.go +43 -0
- data/examples/tutorial/03_scale/web_docker_image/start.sh +7 -0
- data/examples/tutorial/03_scale/web_docker_image/test.bash +6 -0
- data/examples/tutorial/04_test/my-platforms/Gemfile +3 -0
- data/examples/tutorial/04_test/my-platforms/hpc_config.rb +12 -0
- data/examples/tutorial/04_test/my-platforms/images/debian_10/Dockerfile +13 -0
- data/examples/tutorial/04_test/my-platforms/my_commands.bash +2 -0
- data/examples/tutorial/04_test/my-service-conf-repo/inventory.yaml +100 -0
- data/examples/tutorial/04_test/my-service-conf-repo/my-service.conf.erb +3 -0
- data/examples/tutorial/04_test/my-service-conf-repo/service_my-service.rb +58 -0
- data/examples/tutorial/04_test/my-service-conf-repo/service_web-hello.rb +43 -0
- data/examples/tutorial/04_test/node/my-service.conf +4 -0
- data/examples/tutorial/04_test/web_docker_image/Dockerfile +33 -0
- data/examples/tutorial/04_test/web_docker_image/hello_world.txt +1 -0
- data/examples/tutorial/04_test/web_docker_image/hpc_root.key +27 -0
- data/examples/tutorial/04_test/web_docker_image/hpc_root.key.pub +1 -0
- data/examples/tutorial/04_test/web_docker_image/main.go +43 -0
- data/examples/tutorial/04_test/web_docker_image/start.sh +7 -0
- data/examples/tutorial/04_test/web_docker_image/test.bash +6 -0
- data/examples/tutorial/05_extend_with_plugins/dev-servers-conf-repo/hosts.json +12 -0
- data/examples/tutorial/05_extend_with_plugins/dev-servers-conf-repo/install-gcc.bash +14 -0
- data/examples/tutorial/05_extend_with_plugins/dev-servers-conf-repo/install-python.bash +14 -0
- data/examples/tutorial/05_extend_with_plugins/dev_docker_image/Dockerfile +20 -0
- data/examples/tutorial/05_extend_with_plugins/dev_docker_image/hpc_root.key +27 -0
- data/examples/tutorial/05_extend_with_plugins/dev_docker_image/hpc_root.key.pub +1 -0
- data/examples/tutorial/05_extend_with_plugins/my-platforms/Gemfile +4 -0
- data/examples/tutorial/05_extend_with_plugins/my-platforms/hpc_config.rb +13 -0
- data/examples/tutorial/05_extend_with_plugins/my-platforms/images/debian_10/Dockerfile +13 -0
- data/examples/tutorial/05_extend_with_plugins/my-platforms/my_commands.bash +2 -0
- data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/inventory.yaml +100 -0
- data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/my-service.conf.erb +3 -0
- data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/service_my-service.rb +58 -0
- data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/service_web-hello.rb +43 -0
- data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/platform_handler/json_bash.rb +115 -0
- data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb +52 -0
- data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/test/root_space.rb +44 -0
- data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/my_hpc_plugins.gemspec +15 -0
- data/examples/tutorial/05_extend_with_plugins/node/my-service.conf +4 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/Dockerfile +33 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/hello_world.txt +1 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/hpc_root.key +27 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/hpc_root.key.pub +1 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/main.go +43 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/start.sh +7 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/test.bash +6 -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 +15 -4
- 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 +6 -3
- 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 +37 -4
- data/spec/hybrid_platforms_conductor_test/docs_spec.rb +10 -0
- data/tools/check_md +89 -0
- data/tools/generate_mermaid +75 -0
- metadata +337 -12
@@ -0,0 +1,46 @@
|
|
1
|
+
# CMDB plugin: `config`
|
2
|
+
|
3
|
+
The `config` CMDB plugin sets metadata from the Hybrid Platforms Conductor's configuration.
|
4
|
+
|
5
|
+
## Metadata set by this plugin
|
6
|
+
|
7
|
+
| Metadata | Type | Dependent metadata | Usage
|
8
|
+
| --- | --- | --- |
|
9
|
+
| * | Any | None | Any metadata can be set through the `set_metadata` config DSL method |
|
10
|
+
|
11
|
+
## Config DSL extension
|
12
|
+
|
13
|
+
### `set_metadata`
|
14
|
+
|
15
|
+
Set metadata for a set of nodes.
|
16
|
+
It takes the metadata as a `Hash<Symbol,Object>`.
|
17
|
+
|
18
|
+
Example:
|
19
|
+
```ruby
|
20
|
+
# Make sure all test nodes have the environment set correctly and run under CentOS 7.
|
21
|
+
for_nodes('/tst.*/') do
|
22
|
+
set_metadata(
|
23
|
+
environment: 'test',
|
24
|
+
image: 'centos_7'
|
25
|
+
)
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
## Used credentials
|
30
|
+
|
31
|
+
| Credential | Usage
|
32
|
+
| --- | --- |
|
33
|
+
|
34
|
+
## Used Metadata
|
35
|
+
|
36
|
+
| Metadata | Type | Usage
|
37
|
+
| --- | --- | --- |
|
38
|
+
|
39
|
+
## Used environment variables
|
40
|
+
|
41
|
+
| Variable | Usage
|
42
|
+
| --- | --- |
|
43
|
+
|
44
|
+
## External tools dependencies
|
45
|
+
|
46
|
+
None
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# CMDB plugin: `host_ip`
|
2
|
+
|
3
|
+
The `host_ip` CMDB plugin discovers the `host_ip` metadata by querying DNS records using the `hostname` metadata if it is set.
|
4
|
+
|
5
|
+
## Metadata set by this plugin
|
6
|
+
|
7
|
+
| Metadata | Type | Dependent metadata | Usage
|
8
|
+
| --- | --- | --- | --- |
|
9
|
+
| `host_ip` | `String` | `hostname` | The node's IP address as returned by a DNS lookup using the `hostname` metadata |
|
10
|
+
|
11
|
+
## Config DSL extension
|
12
|
+
|
13
|
+
None
|
14
|
+
|
15
|
+
## Used credentials
|
16
|
+
|
17
|
+
| Credential | Usage
|
18
|
+
| --- | --- |
|
19
|
+
|
20
|
+
## Used Metadata
|
21
|
+
|
22
|
+
| Metadata | Type | Usage
|
23
|
+
| --- | --- | --- |
|
24
|
+
| `hostname` | `String` | Used to query the IP from DNS records |
|
25
|
+
|
26
|
+
## Used environment variables
|
27
|
+
|
28
|
+
| Variable | Usage
|
29
|
+
| --- | --- |
|
30
|
+
|
31
|
+
## External tools dependencies
|
32
|
+
|
33
|
+
* `getent`: Used to query DNS.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# CMDB plugin: `host_keys`
|
2
|
+
|
3
|
+
The `host_keys` CMDB plugin discovers the SSH host keys based the IP or hostname of nodes (using either `host_ip` or `hostname` metadata).
|
4
|
+
|
5
|
+
## Metadata set by this plugin
|
6
|
+
|
7
|
+
| Metadata | Type | Dependent metadata | Usage
|
8
|
+
| --- | --- | --- | --- |
|
9
|
+
| `host_keys` | `Array<String>` | `hostname`, `host_ip` | The list of SSH host keys discovered using `ssh-keyscan` |
|
10
|
+
|
11
|
+
## Config DSL extension
|
12
|
+
|
13
|
+
None
|
14
|
+
|
15
|
+
## Used credentials
|
16
|
+
|
17
|
+
| Credential | Usage
|
18
|
+
| --- | --- |
|
19
|
+
|
20
|
+
## Used Metadata
|
21
|
+
|
22
|
+
| Metadata | Type | Usage
|
23
|
+
| --- | --- | --- |
|
24
|
+
| `hostname` | `String` | Used to query the IP from DNS records |
|
25
|
+
|
26
|
+
## Used environment variables
|
27
|
+
|
28
|
+
| Variable | Usage
|
29
|
+
| --- | --- |
|
30
|
+
|
31
|
+
## External tools dependencies
|
32
|
+
|
33
|
+
* `ssh-keyscan`: Used to discover the host keys.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# CMDB plugin: `platform_handlers`
|
2
|
+
|
3
|
+
The `platform_handlers` CMDB plugin sets metadata by querying [`platform_handler`](../platform_handler) plugins.
|
4
|
+
|
5
|
+
## Metadata set by this plugin
|
6
|
+
|
7
|
+
| Metadata | Type | Dependent metadata | Usage
|
8
|
+
| --- | --- | --- |
|
9
|
+
| `services` | `Array<String>` | None | List of services that should be present in a node |
|
10
|
+
| * | Any | None | Any metadata can be set by the platform handlers |
|
11
|
+
|
12
|
+
## Config DSL extension
|
13
|
+
|
14
|
+
None
|
15
|
+
|
16
|
+
## Used credentials
|
17
|
+
|
18
|
+
| Credential | Usage
|
19
|
+
| --- | --- |
|
20
|
+
|
21
|
+
## Used Metadata
|
22
|
+
|
23
|
+
| Metadata | Type | Usage
|
24
|
+
| --- | --- | --- |
|
25
|
+
|
26
|
+
## Used environment variables
|
27
|
+
|
28
|
+
| Variable | Usage
|
29
|
+
| --- | --- |
|
30
|
+
|
31
|
+
## External tools dependencies
|
32
|
+
|
33
|
+
None
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Connector plugin: `local`
|
2
|
+
|
3
|
+
The `local` connector plugin allows remote actions to be executed on localhost, in a dedicated workspace inside `/tmp/hpc_local_workspaces`.
|
4
|
+
This connector should only be used for nodes deploying services on localhost.
|
5
|
+
|
6
|
+
## Config DSL extension
|
7
|
+
|
8
|
+
None
|
9
|
+
|
10
|
+
## Used credentials
|
11
|
+
|
12
|
+
| Credential | Usage
|
13
|
+
| --- | --- |
|
14
|
+
|
15
|
+
## Used Metadata
|
16
|
+
|
17
|
+
| Metadata | Type | Usage
|
18
|
+
| --- | --- | --- |
|
19
|
+
| `local_node` | `Boolean` | If set to true, then consider the node to be handled by this connector |
|
20
|
+
|
21
|
+
## Used environment variables
|
22
|
+
|
23
|
+
| Variable | Usage
|
24
|
+
| --- | --- |
|
25
|
+
|
26
|
+
## External tools dependencies
|
27
|
+
|
28
|
+
None
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Connector plugin: `ssh`
|
2
|
+
|
3
|
+
The `ssh` connector plugin allows remote actions to be executed on nodes having an SSH access.
|
4
|
+
It supports different ways to retrieve the SSH connection details, from configuration, metadata and environment variables.
|
5
|
+
|
6
|
+
## Config DSL extension
|
7
|
+
|
8
|
+
### `gateway`
|
9
|
+
|
10
|
+
Declare a new SSH gateway, with 2 parameters: its name (as a Symbol) and its SSH configuration (as a String).
|
11
|
+
This is used directly in any SSH configuration file used to connect to nodes.
|
12
|
+
Any node can then reference this gateway by using the `gateway` metadata.
|
13
|
+
|
14
|
+
The gateway definition is an ERB template can use the following variables:
|
15
|
+
* `@user` (String): The SSH user name
|
16
|
+
* `@ssh_exec` (String): Path to the SSH executable to be used. Always use this variable instead of `ssh` (for example in proxy commands) as the connector might use a different ssh executable to encapsulate the configuration without polluting the system ssh.
|
17
|
+
|
18
|
+
Examples:
|
19
|
+
```ruby
|
20
|
+
gateway :prod_gw, <<~EOS
|
21
|
+
Host prod.gateway.com
|
22
|
+
User gateway_<%= @user %>
|
23
|
+
ProxyCommand <%= @ssh_exec %> -q -W %h:%p all.gateway.com
|
24
|
+
EOS
|
25
|
+
```
|
26
|
+
|
27
|
+
### `transform_ssh_connection`
|
28
|
+
|
29
|
+
Provide a code block transforing the SSH connection details for nodes.
|
30
|
+
The code block has the following signature:
|
31
|
+
|
32
|
+
*Parameters*:
|
33
|
+
* **node** (`String`): Node for which we transform the SSH connection
|
34
|
+
* **connection** (`String` or `nil`): The connection host or IP, or nil if none
|
35
|
+
* **connection_user** (`String`): The connection user
|
36
|
+
* **gateway** (`String` or `nil`): The gateway name, or nil if none
|
37
|
+
* **gateway_user** (`String` or `nil`): The gateway user, or nil if none
|
38
|
+
*Result*:
|
39
|
+
* `String`: The transformed connection host or IP, or nil if none
|
40
|
+
* `String`: The transformed connection user
|
41
|
+
* `String` or `nil`: The transformed gateway name, or nil if none
|
42
|
+
* `String` or `nil`: The transformed gateway user, or nil if none
|
43
|
+
|
44
|
+
Examples:
|
45
|
+
```ruby
|
46
|
+
# Test nodes have to use the test gateway with hostname in the gateway user name
|
47
|
+
for_nodes('/tst/') do
|
48
|
+
transform_ssh_connection do |node, connection, connection_user, gateway, gateway_user|
|
49
|
+
[
|
50
|
+
'test_gateway.tst.my_domain.com',
|
51
|
+
"#{connection_user}@#{connection}"
|
52
|
+
]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
## Used credentials
|
58
|
+
|
59
|
+
| Credential | Usage
|
60
|
+
| --- | --- |
|
61
|
+
|
62
|
+
## Used Metadata
|
63
|
+
|
64
|
+
| Metadata | Type | Usage
|
65
|
+
| --- | --- | --- |
|
66
|
+
| `description` | `String` | Nodes description added in generated SSH configs |
|
67
|
+
| `gateway_user` | `String` | Name of the gateway user to be used in the SSH config used by the connector. |
|
68
|
+
| `gateway` | `String` | Name of the gateway to be used in the SSH config used by the connector. |
|
69
|
+
| `host_ip` | `String` | The node's IP address to connect to using SSH. If this metadata is not set, then the node is considered as not connectable using the `ssh` connector. |
|
70
|
+
| `host_keys` | `Array<String>` | The node's host keys used to generate a `known_hosts` file with those to avoid user confirmations when connecting. |
|
71
|
+
| `hostname` | `String` | Host name used to connect in case no IP address can be found in metadata. |
|
72
|
+
| `private_ips` | `Array<String>` | IP list to connect in case `host_ip` is not defined in metadata. |
|
73
|
+
| `ssh_session_exec` | `String` | If set to the string `false`, then consider that the node does not have any SSH SessionExec capabilities. This will make sure that remote command executions is done using stdin piping on interactive sessions instead of SSH commands execution. |
|
74
|
+
|
75
|
+
## Used environment variables
|
76
|
+
|
77
|
+
| Variable | Usage
|
78
|
+
| --- | --- |
|
79
|
+
| `hpc_interactive` | If set to `false`, then interactive SSH sessions will fail with an error. Useful to not try interactive mode in non-interactive environments like CI/CD. |
|
80
|
+
| `hpc_ssh_gateway_user` | Default gateway user to be used (can be overriden by the `gateway_user` metadata). |
|
81
|
+
| `hpc_ssh_gateways_conf` | Gateways configuration name to be used in the SSH configuration. The name should match one of the names declared in the configuration (see the `gateway` config DSL extension). |
|
82
|
+
| `hpc_ssh_user` | Name of the user to be used in SSH connections. |
|
83
|
+
| `USER` | Name of the user to be used in SSH connections (only used if the env variable `hpc_ssh_user` is not set). |
|
84
|
+
|
85
|
+
## External tools dependencies
|
86
|
+
|
87
|
+
* `cat`: Used to pipe commands on SSH connections not having SessionExec capabilities.
|
88
|
+
* `env`: Used to set shebangs in bash scripts.
|
89
|
+
* `gzip`: Used to transfer files on SSH connections having SessionExec capabilities.
|
90
|
+
* `scp`: Used to transfer files on SSH connections not having SessionExec capabilities.
|
91
|
+
* `ssh`: Used to run SSH commands or interactive sessions.
|
92
|
+
* `sshpass`: Used when the SSH connections is done using a password that needs to be set automatically (using the `passwords` accessor from the connector).
|
93
|
+
* `tar`: Used to transfer files on SSH connections having SessionExec capabilities.
|
94
|
+
* `whoami`: Used to get ssh user name when environment variables `hpc_ssh_user` and `USER` are not set.
|
95
|
+
* `xterm`: Used to initiate an interactive ControlMaster on SSH connections not having SessionExec capabilities.
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# PlatformHandler plugin: `yaml_inventory`
|
2
|
+
|
3
|
+
The `yaml_inventory` platform handler is just a minimalistic handler supporting an inventory definition from a file named `inventory.yaml`, and services to be deployed using simple Ruby methods defined in files named `service_<service_name>.rb`.
|
4
|
+
It provides an out-of-the-box solution that can be used to define an inventory in case there are no existing repositories to start with.
|
5
|
+
|
6
|
+
## Inventory
|
7
|
+
|
8
|
+
The structure of the `inventory.yaml` file is a hash of `<node_name> => <node_info_hash>`, with `<node_info_hash>` having the following properties:
|
9
|
+
* **metadata** (`Hash<String,Object>`): The node's metadata
|
10
|
+
* **services** (`Array<String>`): The node's services
|
11
|
+
|
12
|
+
Example:
|
13
|
+
```yaml
|
14
|
+
---
|
15
|
+
prod_node:
|
16
|
+
metadata:
|
17
|
+
environment: production
|
18
|
+
image: centos_7
|
19
|
+
services:
|
20
|
+
- firewall
|
21
|
+
|
22
|
+
test_node:
|
23
|
+
metadata:
|
24
|
+
environment: test
|
25
|
+
image: centos_7
|
26
|
+
services:
|
27
|
+
- web_frontend
|
28
|
+
- firewall
|
29
|
+
```
|
30
|
+
|
31
|
+
## Services
|
32
|
+
|
33
|
+
Each file named `service_<service_name>.rb` defines 2 methods: `check` and `deploy` that return [actions](../../plugins.md#action) to execute in order to respectively check and deploy the service named `<service_name>` on a node.
|
34
|
+
Those methods have both the following signature:
|
35
|
+
* Parameters:
|
36
|
+
* **node** (`String`): The node for which we check/deploy the service.
|
37
|
+
* Result:
|
38
|
+
* `Array< Hash<Symbol,Object> >`: The list of actions to execute to check/deploy the service on the node.
|
39
|
+
The code of those methods can use standard logging and the following API components:
|
40
|
+
* **`@config`**: The Config API.
|
41
|
+
* **`@nodes_handler`**: The NodesHandler API.
|
42
|
+
* **`@cmd_runner`**: The CmdRunner API.
|
43
|
+
* **`@platform_handler`**: The platform handler for which this service is being checked/deployed.
|
44
|
+
|
45
|
+
Example of a service file checking for a file's presence on the remote node:
|
46
|
+
```ruby
|
47
|
+
# Check if the service is installed on a node
|
48
|
+
#
|
49
|
+
# Parameters::
|
50
|
+
# * *node* (String): Node for which we check the service installation
|
51
|
+
# Result::
|
52
|
+
# * Array< Hash<Symbol,Object> >: List of actions to execute to check the service
|
53
|
+
def check(node)
|
54
|
+
[
|
55
|
+
{
|
56
|
+
remote_bash: <<~EOS
|
57
|
+
if test -f ~/my-file.txt; then
|
58
|
+
echo "[ SUCCESS ] - File exists."
|
59
|
+
else
|
60
|
+
echo "[ FAILURE ] - File does not exist."
|
61
|
+
fi
|
62
|
+
EOS
|
63
|
+
}
|
64
|
+
]
|
65
|
+
end
|
66
|
+
|
67
|
+
# Deploy the on a node
|
68
|
+
#
|
69
|
+
# Parameters::
|
70
|
+
# * *node* (String): Node for which we deploy the service
|
71
|
+
# Result::
|
72
|
+
# * Array< Hash<Symbol,Object> >: List of actions to execute to deploy the service
|
73
|
+
def deploy(node)
|
74
|
+
[
|
75
|
+
{
|
76
|
+
remote_bash: <<~EOS
|
77
|
+
touch ~/my-file.txt
|
78
|
+
EOS
|
79
|
+
}
|
80
|
+
]
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
## Config DSL extension
|
85
|
+
|
86
|
+
None
|
87
|
+
|
88
|
+
## Used credentials
|
89
|
+
|
90
|
+
| Credential | Usage
|
91
|
+
| --- | --- |
|
92
|
+
|
93
|
+
## Used Metadata
|
94
|
+
|
95
|
+
| Metadata | Type | Usage
|
96
|
+
| --- | --- | --- |
|
97
|
+
|
98
|
+
## Used environment variables
|
99
|
+
|
100
|
+
| Variable | Usage
|
101
|
+
| --- | --- |
|
102
|
+
|
103
|
+
## External tools dependencies
|
104
|
+
|
105
|
+
None
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Provisioner plugin: `docker`
|
2
|
+
|
3
|
+
The `docker` provisioner plugin is handling a local Docker installation to provision nodes.
|
4
|
+
|
5
|
+
## Config DSL extension
|
6
|
+
|
7
|
+
None
|
8
|
+
|
9
|
+
## Used credentials
|
10
|
+
|
11
|
+
| Credential | Usage
|
12
|
+
| --- | --- |
|
13
|
+
|
14
|
+
## Used Metadata
|
15
|
+
|
16
|
+
| Metadata | Type | Usage
|
17
|
+
| --- | --- | --- |
|
18
|
+
| `image` | `String` | The name of the OS image to be used. The [configuration](../../config_dsl.md) should define the image and point it to a directory containing a `Dockerfile` that will be used to provision the Docker container. |
|
19
|
+
|
20
|
+
## Used environment variables
|
21
|
+
|
22
|
+
| Variable | Usage
|
23
|
+
| --- | --- |
|
24
|
+
|
25
|
+
## External tools dependencies
|
26
|
+
|
27
|
+
* Docker local installation.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Provisioner plugin: `podman`
|
2
|
+
|
3
|
+
The `podman` provisioner plugin is handling a local Podman installation to provision nodes.
|
4
|
+
|
5
|
+
## Config DSL extension
|
6
|
+
|
7
|
+
None
|
8
|
+
|
9
|
+
## Used credentials
|
10
|
+
|
11
|
+
| Credential | Usage
|
12
|
+
| --- | --- |
|
13
|
+
|
14
|
+
## Used Metadata
|
15
|
+
|
16
|
+
| Metadata | Type | Usage
|
17
|
+
| --- | --- | --- |
|
18
|
+
| `image` | `String` | The name of the OS image to be used. The [configuration](../../config_dsl.md) should define the image and point it to a directory containing a `Dockerfile` that will be used to provision the Podman container. |
|
19
|
+
|
20
|
+
## Used environment variables
|
21
|
+
|
22
|
+
| Variable | Usage
|
23
|
+
| --- | --- |
|
24
|
+
|
25
|
+
## External tools dependencies
|
26
|
+
|
27
|
+
* `podman`: Used to handle Podman containers.
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# Provisioner plugin: `proxmox`
|
2
|
+
|
3
|
+
The `proxmox` provisioner plugin is using a Proxmox cluster to provision nodes.
|
4
|
+
|
5
|
+
## Config DSL extension
|
6
|
+
|
7
|
+
### `proxmox`
|
8
|
+
|
9
|
+
Define a Proxmox cluster configuration.
|
10
|
+
|
11
|
+
It takes `Hash<Symbol,Object>` as parameter, defining the following properties:
|
12
|
+
* **api_url** (`String`): The Proxmox API URL
|
13
|
+
* **api_max_retries** (`Integer`): Max number of API retries
|
14
|
+
* **api_wait_between_retries_secs** (`Integer`): Number of seconds to wait between API retries
|
15
|
+
* **sync_node** (`String`): Node to be used to synchronize Proxmox resources acquisition
|
16
|
+
* **test_config** (`Hash<Symbol,Object>`): The test configuration, as a hash of properties:
|
17
|
+
* **pve_nodes** (`Array<String>`): List of PVE nodes allowed to spawn new containers [default: all]
|
18
|
+
* **vm_ips_list** (`Array<String>`): The list of IPs that are available for the Proxomx containers.
|
19
|
+
* **vm_ids_range** (`[Integer, Integer`]): Minimum and maximum reservable VM ID
|
20
|
+
* **coeff_ram_consumption** (`Integer`): Importance coefficient to assign to the RAM consumption when selecting available PVE nodes
|
21
|
+
* **coeff_disk_consumption** (`Integer`): Importance coefficient to assign to the disk consumption when selecting available PVE nodes
|
22
|
+
* **expiration_period_secs** (`Integer`): Number of seconds defining the expiration period
|
23
|
+
* **expire_stopped_vm_timeout_secs** (`Integer`): Number of seconds before defining stopped VMs as expired
|
24
|
+
* **limits** (`Hash`): Limits to be taken into account while reserving resources. Each property is optional and no property means no limit.
|
25
|
+
* **nbr_vms_max** (`Integer`): Max number of VMs we can reserve.
|
26
|
+
* **cpu_loads_thresholds** (`[Float, Float, Float]`): CPU load thresholds from which a PVE node should not be used (as soon as 1 of the value is greater than those thresholds, discard the node).
|
27
|
+
* **ram_percent_used_max** (`Float`): Max percentage (between 0 and 1) of RAM that can be reserved on a PVE node.
|
28
|
+
* **disk_percent_used_max** (`Float`): Max percentage (between 0 and 1) of disk that can be reserved on a PVE node.
|
29
|
+
* **vm_config** (`Hash<Symbol,Object>`): Extra configuration of a created container:
|
30
|
+
* **vm_dns_servers** (`Array<String>`): List of DNS servers
|
31
|
+
* **vm_search_domain** (`String`): Default search domain
|
32
|
+
* **vm_gateway** (`String`): Gateway hostname or IP
|
33
|
+
* **default_timeout** (`Integer`): The default timeout to be applied when starting/stopping containers [default: 3600].
|
34
|
+
|
35
|
+
Example:
|
36
|
+
```ruby
|
37
|
+
proxmox(
|
38
|
+
# Entry point API
|
39
|
+
api_url: 'https://my_proxmox.my_domain.com:8006',
|
40
|
+
# This node is used to synchronize all VMs operations
|
41
|
+
sync_node: 'pve_node_1',
|
42
|
+
# Retry in case of API failures
|
43
|
+
api_max_retries: 10,
|
44
|
+
api_wait_between_retries_secs: 20,
|
45
|
+
# When provisioning test containers, make sure we limit their config
|
46
|
+
test_config: {
|
47
|
+
pve_nodes: %w[
|
48
|
+
pve_node_1
|
49
|
+
pve_node_2
|
50
|
+
pve_node_3
|
51
|
+
],
|
52
|
+
vm_ips_list: %w[
|
53
|
+
172.16.110.1
|
54
|
+
172.16.110.2
|
55
|
+
172.16.110.3
|
56
|
+
172.16.110.4
|
57
|
+
172.16.110.5
|
58
|
+
],
|
59
|
+
vm_ids_range: [1000, 1100],
|
60
|
+
# Specify limits above which test containers should not be provisioned to not alter other important VMs
|
61
|
+
coeff_ram_consumption: 10,
|
62
|
+
coeff_disk_consumption: 1,
|
63
|
+
limits: {
|
64
|
+
nbr_vms_max: 20,
|
65
|
+
cpu_loads_thresholds: [10, 10, 10],
|
66
|
+
ram_percent_used_max: 0.75,
|
67
|
+
disk_percent_used_max: 0.75
|
68
|
+
},
|
69
|
+
# Test containers are considered expired after 1 day, or when they are stopped for more than 30 secs
|
70
|
+
expiration_period_secs: 24 * 60 * 60,
|
71
|
+
expire_stopped_vm_timeout_secs: 30
|
72
|
+
},
|
73
|
+
# Any provisioned container should have some common network config
|
74
|
+
vm_config: {
|
75
|
+
vm_dns_servers: ['172.16.110.100', '172.16.110.101'],
|
76
|
+
vm_search_domain: 'my_domain.com',
|
77
|
+
vm_gateway: '172.16.110.200'
|
78
|
+
},
|
79
|
+
# Some containers might take a lot of time to be started/stopped
|
80
|
+
default_timeout: 3600
|
81
|
+
)
|
82
|
+
```
|
83
|
+
|
84
|
+
When a node is provisioned on a Proxmox cluster, the OS to be provisioned is driven by the `image` metadata. This metadata references an image through configuration that is linked to a path containing a file named `proxmox.json`, that contains image-specific configuration:
|
85
|
+
* **template** (`String`): The path to the template to be used for this image on the Proxmox cluster.
|
86
|
+
|
87
|
+
Example for a CentOS 7 image:
|
88
|
+
```json
|
89
|
+
{
|
90
|
+
"template": "Storage:vztmpl/centos-7-ssh_amd64.tar.gz"
|
91
|
+
}
|
92
|
+
```
|
93
|
+
|
94
|
+
## Used credentials
|
95
|
+
|
96
|
+
| Credential | Usage
|
97
|
+
| --- | --- |
|
98
|
+
| `proxmox` | Used to connect to the Proxmox API |
|
99
|
+
|
100
|
+
## Used Metadata
|
101
|
+
|
102
|
+
| Metadata | Type | Usage
|
103
|
+
| --- | --- | --- |
|
104
|
+
| `deploy_resources_min` | `Hash<Symbol, Integer>` | A hash of resources to allocate to a container for a node. Properties are `cpus`, `ram_mb` and `disk_gb`, and set the number of CPUs, MB of RAM and GB of disk to allocate to the container. Defaults are 2 cpus, 1024 MB of RAM and 10 GB of disk. |
|
105
|
+
| `image` | `String` | The name of the OS image to be used. The [configuration](../../config_dsl.md) should define the image and point it to a directory containing a `proxmox.json` that will contain Proxmox-specific configuration (see above). |
|
106
|
+
|
107
|
+
## Used environment variables
|
108
|
+
|
109
|
+
| Variable | Usage
|
110
|
+
| --- | --- |
|
111
|
+
| `hpc_realm_for_proxmox` | Realm to be used with the `proxmox` credentials to connect to the Proxmox API. Defaults to `pam`. |
|
112
|
+
|
113
|
+
## External tools dependencies
|
114
|
+
|
115
|
+
None
|