From ab9fa7e00888aa7996defe061a85bfb2c4de016f Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 1 Nov 2023 11:09:55 +0100 Subject: [PATCH] WIP: Integriere Hetzner Storage Boxes --- README.md | 2 +- templates/item.txt.j2 | 6 ++++++ templates/section_storage_boxes.txt.j2 | 4 ++++ templates/servers.txt.j2 | 1 + templates/storage_boxes.txt.j2 | 5 +++++ 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 templates/section_storage_boxes.txt.j2 create mode 100644 templates/storage_boxes.txt.j2 diff --git a/README.md b/README.md index 45f8993..0116e25 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Configuration Management Database ================================= -Diese Rolle erstellt CMDB innerhalb eines vorhandenen Dokuwikis. +Diese Rolle erstellt eine [CMDB](https://de.wikipedia.org/wiki/Configuration_Management_Database) innerhalb eines vorhandenen Dokuwikis. ## Installation Führe die Rolle mit dem `install`-Tag aus: diff --git a/templates/item.txt.j2 b/templates/item.txt.j2 index f58ba12..32bcc21 100644 --- a/templates/item.txt.j2 +++ b/templates/item.txt.j2 @@ -19,6 +19,7 @@ {% include 'section_customer.txt.j2' %} {% endif %} +{% if inventory_hostname not in storage_boxes %} {% include 'section_general.txt.j2' %} {% include 'section_os-software.txt.j2' %} @@ -30,6 +31,11 @@ {% include 'section_mounted_fs.txt.j2' %} {% include 'section_networking.txt.j2' %} +{% endif %} + +{% if inventory_hostname in storage_boxes %} +{% include 'section_storage_boxes.txt.j2' %} +{% endif %} {% if "qemu-system-x86" in ansible_facts.packages %} ===== KVM ===== diff --git a/templates/section_storage_boxes.txt.j2 b/templates/section_storage_boxes.txt.j2 new file mode 100644 index 0000000..9afdb7e --- /dev/null +++ b/templates/section_storage_boxes.txt.j2 @@ -0,0 +1,4 @@ +===== Storage Boxes ===== + + * {{ ansible_host }}:{{ ansible_port }} + * {{ ansible_user }} diff --git a/templates/servers.txt.j2 b/templates/servers.txt.j2 index 574e799..a90825c 100644 --- a/templates/servers.txt.j2 +++ b/templates/servers.txt.j2 @@ -2,3 +2,4 @@ * [[cmdb:servers:all|Alle Server]] * [[cmdb:servers:hypervisor|Hypervisor]] + * [[cmdb:servers:storage_boxes|Storage Boxes]] diff --git a/templates/storage_boxes.txt.j2 b/templates/storage_boxes.txt.j2 new file mode 100644 index 0000000..f716f9b --- /dev/null +++ b/templates/storage_boxes.txt.j2 @@ -0,0 +1,5 @@ +====== Storage Boxes ====== + +{% for host in groups['storage_boxes'] | sort %} + * [[cmdb:servers:all:{{ host }}]] +{% endfor %}