From 122bd5cdf41f6e9178a3ba0a505fb25cfe82c14b Mon Sep 17 00:00:00 2001 From: Sandwich Date: Mon, 10 Feb 2025 15:14:46 +0100 Subject: [PATCH] Add DNS Search option --- README.md | 1 + inventory_example.yml | 1 + roles/configuration/templates/network.j2 | 3 +++ 3 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 1f912ca..1f10a4c 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ Inventory variables are defined for individual hosts or VMs in the inventory fil | `vm_ballo` (optional) | Ballooning memory size for the VM, used to adjust memory allocation dynamically. | `2048` | | `vm_cpus` | Number of CPU cores assigned to the virtual machine. | `4` | | `vm_dns` | DNS server IP address(es) for the virtual machine's network configuration. | `1.0.0.1`, `1.1.1.1` | +| `vm_dns_search` | DNS search zone for the virtual machine's network configuration. | `example.com` | | `vm_gw` | Default gateway IP address for the virtual machine's network configuration. | `192.168.0.1` | | `vm_id` | Unique identifier for the virtual machine. | `101` | | `vm_ip` | IP address assigned to the virtual machine. | `192.168.0.10` | diff --git a/inventory_example.yml b/inventory_example.yml index eeb1db8..8b93a5c 100644 --- a/inventory_example.yml +++ b/inventory_example.yml @@ -19,6 +19,7 @@ all: vm_nif: vmbr1 vm_gw: 192.168.122.1 vm_dns: 1.1.1.1 + vm_dns_search: "example.com" 192.168.122.11: hostname: database vm_id: 101 diff --git a/roles/configuration/templates/network.j2 b/roles/configuration/templates/network.j2 index a57c52f..062b65b 100644 --- a/roles/configuration/templates/network.j2 +++ b/roles/configuration/templates/network.j2 @@ -9,6 +9,9 @@ mac-address={{ net_mac.stdout }} [ipv4] address={{ vm_ip }}/{{ vm_nms | default (24) }},{{ vm_gw }} dns={{ vm_dns }} +{% if vm_dns_search is defined %} +dns-search={{ vm_dns_search }} +{% endif %} method=manual [ipv6]