Add network mask variables for Hypervisor static IP assigments

This commit is contained in:
Sandwich 2024-10-30 14:33:38 +01:00
parent c8dd89681b
commit ca5a3c8807
3 changed files with 6 additions and 2 deletions

View File

@ -83,6 +83,8 @@ Inventory variables are defined for individual hosts or VMs in the inventory fil
| `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` |
| `vm_nm` (optional) | IP address netmask assigned to the virtual machine. | `255.255.255.0` |
| `vm_nms` (optional) | IP address netmask assigned to the virtual machine. | `24` |
| `vm_memory` | Amount of memory (in MB) allocated to the virtual machine. | `2048` |
| `vm_nif` | Network interface type or identifier for the VM's network connection. | `vmbr0` |
| `vm_path (optional)` | Path or folder where the VM configuration or related files will be stored. | `/var/lib/libvirt/images/` |

View File

@ -35,7 +35,9 @@
iso_path: "{{ boot_iso }}"
networks:
- vlan: "{{ vlan_name }}"
type: dhcp
type: static
ip: "{{ inventory_hostname }}"
netmask: "{{ vm_mask | default('255.255.255.0') }}"
register: vmware_guest_result
failed_when:
- vmware_guest_result.failed is defined and vmware_guest_result.failed

View File

@ -1,4 +1,4 @@
vm_ip: "{{ inventory_hostname }}/24"
vm_ip: "{{ inventory_hostname }}/{{ vm_nms }}"
install_type: "virtual"
cis: false