i got following task to create mul;tiple vlan ports groups on a vswitch on 5 esxi hosts
task playbok is
i got following task to create mul;tiple vlan ports groups on a vswitch on 5 esxi hosts
task playbok is
any idea?
The simplest way would be add the vlans and portgroup names as a list in vars
Then loop through them using with_items
Like this
vlans:
portgroup_name: vlan 1
vlan_id: 1
portgroup_name: vlan 2
vlan_id: 2
portgroup_name: vlan 3
vlan_id: 3
name: create_vss_vlan_PGs
vmware_portgroup:
hostname: ‘{{ vcenter_hostname }}’
username: ‘{{ vcenter_username }}’
password: ‘{{ vcenter_password }}’
cluster_name: ‘{{ cluster_name }}’
switch_name: ‘{{ vswitch_name }}’
portgroup_name: ‘{{ item.portgroup_name }}’
vlan_id: ‘{{ item.vlan_id }}’
delegate_to: localhost
with_items: ‘{{ vlans }}’
does the vlan Ids need to be in separate vars file? which file should they be in?
Nope, you can put them directly in the playbook in the vars section. Similar to this: https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html
hi
Is it possible to override default failover NIC policy?
I need to have 2 active nics on each portgroup
Yeah sure can.
Check this out, the last example has what you’re looking for
https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_portgroup_module.html