diff --git a/src/Service/HtmlGeneratorService.php b/src/Service/HtmlGeneratorService.php
index 97d57fd..9a5da4f 100644
--- a/src/Service/HtmlGeneratorService.php
+++ b/src/Service/HtmlGeneratorService.php
@@ -64,6 +64,16 @@ public function generateHosts($resources): void
)
);
+ file_put_contents(
+ $this->pathOutput . '/hosts.csv',
+ $this->twig->render(
+ 'hosts.csv.twig',
+ [
+ 'resources' => $resources,
+ ]
+ )
+ );
+
foreach ($resources as $resource) {
file_put_contents(
$this->pathOutput . '/hosts:' . $resource['name'] . '.html',
diff --git a/templates/host.html.twig b/templates/host.html.twig
index 25d587b..9780be0 100644
--- a/templates/host.html.twig
+++ b/templates/host.html.twig
@@ -2,6 +2,7 @@
{% block body %}
Host: {{ resource.name }}
+
- Name
- {{ resource.name }}
diff --git a/templates/hosts.csv.twig b/templates/hosts.csv.twig
new file mode 100644
index 0000000..6ec4e8d
--- /dev/null
+++ b/templates/hosts.csv.twig
@@ -0,0 +1,6 @@
+name;os;publicIp;privateIp;status;services;labels;
+{% for resource in resources %}
+{{ resource.name }};{{ resource.osRelease.name }};{{ resource.publicIp }};{{ resource.privateIp }};{{ resource.status }};{% for service in resource.services %}{{ service.name}} {% endfor %};{% for label in resource.labels %}
+{{ label.key}}:{{ label.value}} {% endfor %};
+{% endfor %}
+
diff --git a/templates/hosts.html.twig b/templates/hosts.html.twig
index 998ccf8..a9a1d72 100644
--- a/templates/hosts.html.twig
+++ b/templates/hosts.html.twig
@@ -4,6 +4,9 @@
resources
{{ resources|length }}
+
+ Export to csv
+