From 26f1299b59e3ada748cc54fd666538793ba69248 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Mon, 25 Apr 2022 01:33:55 +0200 Subject: [PATCH] Generate also hosts and hostname files --- baz.py | 2 ++ templates/hostname | 1 + templates/hosts | 5 +++++ 3 files changed, 8 insertions(+) create mode 100644 templates/hostname create mode 100644 templates/hosts diff --git a/baz.py b/baz.py index 5c3b351..e568ba1 100755 --- a/baz.py +++ b/baz.py @@ -27,6 +27,8 @@ class Computer: 'qemu.sh', 'interfaces', 'bird.conf', + 'hosts', + 'hostname', ] context = {'c': self} diff --git a/templates/hostname b/templates/hostname new file mode 100644 index 0000000..4084189 --- /dev/null +++ b/templates/hostname @@ -0,0 +1 @@ +host-{{ c.name }} diff --git a/templates/hosts b/templates/hosts new file mode 100644 index 0000000..1d4ef8f --- /dev/null +++ b/templates/hosts @@ -0,0 +1,5 @@ +{% for br in c.bridges %} +172.23.{{ br.num }}.{{ c.num }} host-{{ c.name }}-net-{{ br.num }} +{% endfor %} +127.0.0.1 host-{{ c.name }} localhost localhost.localdomain +::1 host-{{ c.name }} localhost localhost.localdomain