hybrid_platforms_conductor 32.11.1 → 32.13.2
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 +1115 -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 +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/report/templates/confluence_inventory.html.erb +1 -1
- 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/hpc_plugins/test_report/templates/confluence.html.erb +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,20 @@
|
|
1
|
+
# syntax=docker/dockerfile:1
|
2
|
+
# Pull the image containing Go
|
3
|
+
FROM debian:buster
|
4
|
+
|
5
|
+
# Install sshd
|
6
|
+
RUN apt-get update && apt-get install -y openssh-server
|
7
|
+
RUN mkdir /var/run/sshd
|
8
|
+
# Activate root login
|
9
|
+
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
10
|
+
# Speed-up considerably ssh performance and avoid huge lags and timeouts without DNS
|
11
|
+
RUN sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
|
12
|
+
EXPOSE 22
|
13
|
+
|
14
|
+
# Upload our root key for key authentication of root
|
15
|
+
COPY hpc_root.key.pub /root/.ssh/authorized_keys
|
16
|
+
RUN chmod 700 /root/.ssh
|
17
|
+
RUN chmod 400 /root/.ssh/authorized_keys
|
18
|
+
|
19
|
+
# Startup command
|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U2UFfLd859U9kpupYgKcOgwuDDJABK5s1th/LBnrWoQ4GQx9TGRRshr+ypIOAAJzM5g+MvfN9p2gvT/QnZBwmNKOWMamKJB9f5YXJn77RKkMEZBB0y0+x7MJ/zJhQ4I57eh5eR7eLl9d12XhvQpI+yqTQRN+s04zDo1n+Z3OGUbGdT9Romg7bx/iCBlUbDIRTOvrxxxZINeCmcfBQsycP3cXJNDJeflXzQGhvnHd1bmHGXUk/62mktW4R4CzdiHP1nxY7APO634rk6O8oOJVxEAP5ueDlJPDn/WbkBzcfzKeXk0ZfS6ymJJ8wUpdiwBbTP admin@example.com
|
@@ -0,0 +1,13 @@
|
|
1
|
+
yaml_inventory_platform path: "#{Dir.home}/hpc_tutorial/my-service-conf-repo"
|
2
|
+
for_nodes('web1') do
|
3
|
+
expect_tests_to_fail %i[connection], 'web1 is temporarily down - will bring it up later'
|
4
|
+
end
|
5
|
+
# Select only the nodes implementing our web-hello service (that is all the webN nodes)
|
6
|
+
for_nodes [{ service: 'web-hello' }] do
|
7
|
+
# On our web servers we should have users used by our services
|
8
|
+
check_local_users_do_exist %w[sshd www-data]
|
9
|
+
# Make sure we have no leftovers of obsolete users
|
10
|
+
check_local_users_do_not_exist %w[dangerous_user obsolete_user]
|
11
|
+
end
|
12
|
+
os_image :debian_10, "#{hybrid_platforms_dir}/images/debian_10"
|
13
|
+
json_bash_platform path: "#{Dir.home}/hpc_tutorial/dev-servers-conf-repo"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# syntax=docker/dockerfile:1
|
2
|
+
FROM debian:buster
|
3
|
+
|
4
|
+
RUN apt-get update && apt-get install -y openssh-server
|
5
|
+
RUN mkdir /var/run/sshd
|
6
|
+
# Activate root login with test password
|
7
|
+
RUN echo 'root:root_pwd' | chpasswd
|
8
|
+
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
9
|
+
# Speed-up considerably ssh performance and avoid huge lags and timeouts without DNS
|
10
|
+
RUN sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
|
11
|
+
EXPOSE 22
|
12
|
+
|
13
|
+
CMD ["/usr/sbin/sshd", "-D"]
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
local:
|
3
|
+
metadata:
|
4
|
+
description: The local environment
|
5
|
+
local_node: true
|
6
|
+
service_port: 1107
|
7
|
+
service_timeout: 60
|
8
|
+
services:
|
9
|
+
- my-service
|
10
|
+
web1:
|
11
|
+
metadata:
|
12
|
+
description: Web service nbr 1
|
13
|
+
image: debian_10
|
14
|
+
hostname: web1.hpc_tutorial.org
|
15
|
+
planet: Mercury
|
16
|
+
service_port: 1201
|
17
|
+
service_timeout: 60
|
18
|
+
services:
|
19
|
+
- web-hello
|
20
|
+
- my-service
|
21
|
+
web2:
|
22
|
+
metadata:
|
23
|
+
description: Web service nbr 2
|
24
|
+
image: debian_10
|
25
|
+
hostname: web2.hpc_tutorial.org
|
26
|
+
planet: Venus
|
27
|
+
service_port: 1202
|
28
|
+
service_timeout: 60
|
29
|
+
services:
|
30
|
+
- web-hello
|
31
|
+
- my-service
|
32
|
+
web3:
|
33
|
+
metadata:
|
34
|
+
description: Web service nbr 3
|
35
|
+
image: debian_10
|
36
|
+
hostname: web3.hpc_tutorial.org
|
37
|
+
planet: Earth
|
38
|
+
service_port: 1203
|
39
|
+
service_timeout: 60
|
40
|
+
services:
|
41
|
+
- web-hello
|
42
|
+
- my-service
|
43
|
+
web4:
|
44
|
+
metadata:
|
45
|
+
description: Web service nbr 4
|
46
|
+
image: debian_10
|
47
|
+
hostname: web4.hpc_tutorial.org
|
48
|
+
planet: Mars
|
49
|
+
service_port: 1204
|
50
|
+
service_timeout: 60
|
51
|
+
services:
|
52
|
+
- web-hello
|
53
|
+
- my-service
|
54
|
+
web5:
|
55
|
+
metadata:
|
56
|
+
description: Web service nbr 5
|
57
|
+
image: debian_10
|
58
|
+
hostname: web5.hpc_tutorial.org
|
59
|
+
planet: Jupiter
|
60
|
+
service_port: 1205
|
61
|
+
service_timeout: 60
|
62
|
+
services:
|
63
|
+
- web-hello
|
64
|
+
- my-service
|
65
|
+
web6:
|
66
|
+
metadata:
|
67
|
+
description: Web service nbr 6
|
68
|
+
image: debian_10
|
69
|
+
hostname: web6.hpc_tutorial.org
|
70
|
+
services:
|
71
|
+
- web-hello
|
72
|
+
web7:
|
73
|
+
metadata:
|
74
|
+
description: Web service nbr 7
|
75
|
+
image: debian_10
|
76
|
+
hostname: web7.hpc_tutorial.org
|
77
|
+
services:
|
78
|
+
- web-hello
|
79
|
+
web8:
|
80
|
+
metadata:
|
81
|
+
description: Web service nbr 8
|
82
|
+
image: debian_10
|
83
|
+
hostname: web8.hpc_tutorial.org
|
84
|
+
services:
|
85
|
+
- web-hello
|
86
|
+
web9:
|
87
|
+
metadata:
|
88
|
+
description: Web service nbr 9
|
89
|
+
image: debian_10
|
90
|
+
hostname: web9.hpc_tutorial.org
|
91
|
+
services:
|
92
|
+
- web-hello
|
93
|
+
web10:
|
94
|
+
metadata:
|
95
|
+
description: Web service nbr 10
|
96
|
+
image: debian_10
|
97
|
+
hostname: web10.hpc_tutorial.org
|
98
|
+
# The list of service names this node should have
|
99
|
+
services:
|
100
|
+
- web-hello
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Get the wanted content of the configuration file as a String, based on the node's metadata
|
2
|
+
#
|
3
|
+
# Parameters::
|
4
|
+
# * *node* (String): Node for which we configure our service
|
5
|
+
# Result::
|
6
|
+
# * String: The wanted content
|
7
|
+
def wanted_conf_for(node)
|
8
|
+
# We will access the node's metadata using the NodesHandler API, through the @nodes_handler object
|
9
|
+
@service_port = @nodes_handler.get_service_port_of(node)
|
10
|
+
@service_timeout = @nodes_handler.get_service_timeout_of(node)
|
11
|
+
# We use erubis to generate the configuration from our eRuby template, and return it directly
|
12
|
+
Erubis::Eruby.new(File.read("#{@platform_handler.repository_path}/my-service.conf.erb")).result(binding)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get actions to check the node's service against the wanted content
|
16
|
+
#
|
17
|
+
# Parameters::
|
18
|
+
# * *node* (String): Node on which we check the service
|
19
|
+
# Result::
|
20
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
21
|
+
def check(node)
|
22
|
+
# We first dump the wanted content in a temporary file and then we diff it.
|
23
|
+
[
|
24
|
+
{
|
25
|
+
remote_bash: <<~EOS
|
26
|
+
cat <<EOF >/tmp/my-service.conf.wanted
|
27
|
+
#{wanted_conf_for(node)}
|
28
|
+
EOF
|
29
|
+
echo Diffs on my-service.conf:
|
30
|
+
if test -f ~/hpc_tutorial/node/my-service.conf; then
|
31
|
+
diff ~/hpc_tutorial/node/my-service.conf /tmp/my-service.conf.wanted || true
|
32
|
+
else
|
33
|
+
echo "Create file from scratch"
|
34
|
+
cat /tmp/my-service.conf.wanted
|
35
|
+
fi
|
36
|
+
EOS
|
37
|
+
}
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get actions to deploy the node's service against the wanted content
|
42
|
+
#
|
43
|
+
# Parameters::
|
44
|
+
# * *node* (String): Node on which we deploy the service
|
45
|
+
# Result::
|
46
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
47
|
+
def deploy(node)
|
48
|
+
# We first check, as this will display diffs and prepare the file to be copied.
|
49
|
+
# And then we really deploy the file on our node.
|
50
|
+
check(node) + [
|
51
|
+
{
|
52
|
+
remote_bash: <<~EOS
|
53
|
+
mkdir -p ~/hpc_tutorial/node
|
54
|
+
cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
|
55
|
+
EOS
|
56
|
+
}
|
57
|
+
]
|
58
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Get actions to check the node's service against the wanted content
|
2
|
+
#
|
3
|
+
# Parameters::
|
4
|
+
# * *node* (String): Node on which we check the service
|
5
|
+
# Result::
|
6
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
7
|
+
def check(node)
|
8
|
+
# We first dump the wanted content in a temporary file and then we diff it.
|
9
|
+
# We will access the node's planet, hostname and IP from its metadata using the NodesHandler API, through the @nodes_handler object
|
10
|
+
[
|
11
|
+
{
|
12
|
+
remote_bash: <<~EOS
|
13
|
+
echo 'Hello #{@nodes_handler.get_planet_of(node) || 'World'} from #{@nodes_handler.get_hostname_of(node)} (#{@nodes_handler.get_host_ip_of(node)})' >/tmp/hello_world.txt.wanted
|
14
|
+
echo Diffs on hello_world.txt:
|
15
|
+
if test -f /root/hello_world.txt; then
|
16
|
+
diff /root/hello_world.txt /tmp/hello_world.txt.wanted || true
|
17
|
+
else
|
18
|
+
echo "Create hello_world.txt from scratch"
|
19
|
+
cat /tmp/hello_world.txt.wanted
|
20
|
+
fi
|
21
|
+
EOS
|
22
|
+
}
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Get actions to deploy the node's service against the wanted content
|
27
|
+
#
|
28
|
+
# Parameters::
|
29
|
+
# * *node* (String): Node on which we deploy the service
|
30
|
+
# Result::
|
31
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
32
|
+
def deploy(node)
|
33
|
+
# We first check, as this will display diffs and prepare the file to be copied.
|
34
|
+
# And then we really deploy the file on our node.
|
35
|
+
check(node) + [
|
36
|
+
{
|
37
|
+
remote_bash: <<~EOS
|
38
|
+
mkdir -p ~/hpc_tutorial/node
|
39
|
+
cp /tmp/hello_world.txt.wanted /root/hello_world.txt
|
40
|
+
EOS
|
41
|
+
}
|
42
|
+
]
|
43
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'hybrid_platforms_conductor/platform_handler'
|
3
|
+
|
4
|
+
module MyHpcPlugins
|
5
|
+
|
6
|
+
module HpcPlugins
|
7
|
+
|
8
|
+
module PlatformHandler
|
9
|
+
|
10
|
+
# A nice platform handler to handle platforms of our team, using json inventory and bash scripts.
|
11
|
+
class JsonBash < HybridPlatformsConductor::PlatformHandler
|
12
|
+
|
13
|
+
# Get the list of known nodes.
|
14
|
+
# [API] - This method is mandatory.
|
15
|
+
#
|
16
|
+
# Result::
|
17
|
+
# * Array<String>: List of node names
|
18
|
+
def known_nodes
|
19
|
+
# This method is used to get the list of nodes that are handled by the platform
|
20
|
+
# In our case we read our json file to get this information, and use just the first part of the hostname as the node's name.
|
21
|
+
JSON.parse(File.read("#{repository_path}/hosts.json")).keys.map { |hostname| hostname.split('.').first }
|
22
|
+
end
|
23
|
+
|
24
|
+
# Get the metadata of a given node.
|
25
|
+
# [API] - This method is mandatory.
|
26
|
+
#
|
27
|
+
# Parameters::
|
28
|
+
# * *node* (String): Node to read metadata from
|
29
|
+
# Result::
|
30
|
+
# * Hash<Symbol,Object>: The corresponding metadata
|
31
|
+
def metadata_for(node)
|
32
|
+
# All nodes handled by this platform are running a debian buster image and we derive their name from their hostname.
|
33
|
+
{
|
34
|
+
hostname: "#{node}.hpc_tutorial.org",
|
35
|
+
image: 'debian_10'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Return the services for a given node
|
40
|
+
# [API] - This method is mandatory.
|
41
|
+
#
|
42
|
+
# Parameters::
|
43
|
+
# * *node* (String): node to read configuration from
|
44
|
+
# Result::
|
45
|
+
# * Array<String>: The corresponding services
|
46
|
+
def services_for(node)
|
47
|
+
# This info is taken from our JSON inventory file
|
48
|
+
[JSON.parse(File.read("#{repository_path}/hosts.json"))["#{node}.hpc_tutorial.org"]]
|
49
|
+
end
|
50
|
+
|
51
|
+
# Get the list of services we can deploy
|
52
|
+
# [API] - This method is mandatory.
|
53
|
+
#
|
54
|
+
# Result::
|
55
|
+
# * Array<String>: The corresponding services
|
56
|
+
def deployable_services
|
57
|
+
# This info is taken by listing existing bash scripts
|
58
|
+
Dir.glob("#{repository_path}/install-*.bash").map { |file| File.basename(file).match(/install-(.*)\.bash/)[1] }
|
59
|
+
end
|
60
|
+
|
61
|
+
# Get the list of actions to perform to deploy on a given node.
|
62
|
+
# Those actions can be executed in parallel with other deployments on other nodes. They must be thread safe.
|
63
|
+
# [API] - This method is mandatory.
|
64
|
+
# [API] - @cmd_runner is accessible.
|
65
|
+
# [API] - @actions_executor is accessible.
|
66
|
+
#
|
67
|
+
# Parameters::
|
68
|
+
# * *node* (String): Node to deploy on
|
69
|
+
# * *service* (String): Service to be deployed
|
70
|
+
# * *use_why_run* (Boolean): Do we use a why-run mode? [default = true]
|
71
|
+
# Result::
|
72
|
+
# * Array< Hash<Symbol,Object> >: List of actions to be done
|
73
|
+
def actions_to_deploy_on(node, service, use_why_run: true)
|
74
|
+
# This method returns all the actions to execute to deploy on a node.
|
75
|
+
# The use_why_run switch is on if the deployment should just be simulated.
|
76
|
+
# Those actions (bash commands, scp of files, ruby code...) should be thread safe as they can be executed in parallel with other deployment actions for other nodes in case of a concurrent deployment on several nodes.
|
77
|
+
# In our case it's very simple: we just call our bash script on the node's hostname.
|
78
|
+
[{ bash: "#{repository_path}/install-#{service}.bash #{@nodes_handler.get_hostname_of(node)} #{use_why_run ? 'check' : ''}" }]
|
79
|
+
end
|
80
|
+
|
81
|
+
# Parse stdout and stderr of a given deploy run and get the list of tasks with their status
|
82
|
+
# [API] - This method is mandatory.
|
83
|
+
#
|
84
|
+
# Parameters::
|
85
|
+
# * *stdout* (String): stdout to be parsed
|
86
|
+
# * *stderr* (String): stderr to be parsed
|
87
|
+
# Result::
|
88
|
+
# * Array< Hash<Symbol,Object> >: List of task properties. The following properties should be returned, among free ones:
|
89
|
+
# * *name* (String): Task name
|
90
|
+
# * *status* (Symbol): Task status. Should be one of:
|
91
|
+
# * *:changed*: The task has been changed
|
92
|
+
# * *:identical*: The task has not been changed
|
93
|
+
# * *diffs* (String): Differences, if any
|
94
|
+
def parse_deploy_output(stdout, stderr)
|
95
|
+
# In our case our bash scripts return the last line as a status, so use it.
|
96
|
+
[{
|
97
|
+
name: 'Install tool',
|
98
|
+
status:
|
99
|
+
case stdout.split("\n").last
|
100
|
+
when 'OK'
|
101
|
+
:identical
|
102
|
+
else
|
103
|
+
:changed
|
104
|
+
end,
|
105
|
+
diffs: stdout
|
106
|
+
}]
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/report'
|
2
|
+
|
3
|
+
module MyHpcPlugins
|
4
|
+
|
5
|
+
module HpcPlugins
|
6
|
+
|
7
|
+
module Report
|
8
|
+
|
9
|
+
# Publish reports to our web reporting tool
|
10
|
+
class WebReport < HybridPlatformsConductor::Report
|
11
|
+
|
12
|
+
# Give the list of supported locales by this report generator
|
13
|
+
# [API] - This method is mandatory.
|
14
|
+
#
|
15
|
+
# Result::
|
16
|
+
# * Array<Symbol>: List of supported locales
|
17
|
+
def self.supported_locales
|
18
|
+
# This method has to publish the list of translations it accepts.
|
19
|
+
[:en]
|
20
|
+
end
|
21
|
+
|
22
|
+
# Create a report for a list of nodes, in a given locale
|
23
|
+
# [API] - This method is mandatory.
|
24
|
+
#
|
25
|
+
# Parameters::
|
26
|
+
# * *nodes* (Array<String>): List of nodes
|
27
|
+
# * *locale_code* (Symbol): The locale code
|
28
|
+
def report_for(nodes, locale_code)
|
29
|
+
# This method simply provides a report for a given list of nodes in the desired locale.
|
30
|
+
# The locale will be one of the supported ones.
|
31
|
+
# Generate the report in a file to be uploaded on web10.
|
32
|
+
File.write(
|
33
|
+
'/tmp/web_report.txt',
|
34
|
+
@platforms_handler.known_platforms.map do |platform|
|
35
|
+
"= Inventory for platform #{platform.repository_path} of type #{platform.platform_type}:\n" +
|
36
|
+
platform.known_nodes.map do |node|
|
37
|
+
"* Node #{node} (IP: #{@nodes_handler.get_host_ip_of(node)}, Hostname: #{@nodes_handler.get_hostname_of(node)})."
|
38
|
+
end.join("\n")
|
39
|
+
end.join("\n")
|
40
|
+
)
|
41
|
+
# Upload the file on our web10 instance
|
42
|
+
system 'scp -o StrictHostKeyChecking=no /tmp/web_report.txt root@web10.hpc_tutorial.org:/root/hello_world.txt'
|
43
|
+
out 'Upload successful'
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|