diff --git a/README.md b/README.md index 9816bbf..15e3497 100644 --- a/README.md +++ b/README.md @@ -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/` | diff --git a/roles/virtualization/tasks/vmware.yml b/roles/virtualization/tasks/vmware.yml index 9988e41..2c130de 100644 --- a/roles/virtualization/tasks/vmware.yml +++ b/roles/virtualization/tasks/vmware.yml @@ -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 diff --git a/vars_example.yml b/vars_example.yml index 4ea19b1..012134e 100644 --- a/vars_example.yml +++ b/vars_example.yml @@ -1,4 +1,4 @@ -vm_ip: "{{ inventory_hostname }}/24" +vm_ip: "{{ inventory_hostname }}/{{ vm_nms }}" install_type: "virtual" cis: false