Improve Ip set on VMware hypervisors

This commit is contained in:
Sandwich 2024-10-30 18:04:46 +01:00
parent c60fcca86d
commit 26824ca6bb

View File

@ -28,13 +28,13 @@
- name: Set IP-Address
when: hypervisor == "vmware"
ansible.builtin.command: ip addr replace {{ ansible_host }}/24 dev {{ interface_name.stdout }}
ansible.builtin.command: "ip addr replace {{ ansible_host }}/{{ vm_nms | default(24) }} dev {{ interface_name.stdout }}"
changed_when: result.rc == 0
register: result
- name: Set Default Gateway
when: hypervisor == "vmware"
ansible.builtin.command: ip route replace default via {{ vm_gw }}
ansible.builtin.command: "ip route replace default via {{ vm_gw }}"
changed_when: result.rc == 0
register: result