-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Background: Ethernet Network Group Policy requires the following VLAN inputs:
- Native VLAN
- Allowed VLANs.
You can only specify one Native VLAN while Allowed VLANs can have single or multiple VLANs. When specifying multiple VLANs, it could be a list of comma-separated VLANs, a contiguous range, or a combination of the two.
Two issues:
- Regardless of whether you're specifying Native VLAN or Allowed VLANs, they should be treated the same. In other words, when you define these variables and then reference them in the policy, you should not have to convert one of them to string, the other to integer or any combination. One should be able to define the VLANs in a consistent manner (i.e. with or without single or double quotes) and when you reference the variable in an ansible task, they should be referenced in a consistent manner (i.e. without requiring one of them to be converted). This is not the case today.
- When defining multiple VLANs using range (i.e. using a '-') and then when you reference it, the VLANs are treated as strings but if you use a single vlan or multiple VLANs using a comma-separated list (no range), it is treated as something else and not as string.
VLAN Vars file:
# -------------------------------------------------------------------------------------
# Ethernet Network Group (ENG) Policies - specifies VLANs allowed on a given vNIC
# -------------------------------------------------------------------------------------
# OpenShift IB Management VLANs for Power Management (BMC/Provisioning Network)
name_of_ib_mgmt_eng_policy : "{{ prefix }}-IB-Mgmt-ENG_Policy"
description_of_ib_mgmt_eng_policy : "Ethernet Network Group(ENG) Policy for OpenShift In-Band Management"
# native_vlan_for_ib_mgmt_vnic : 2
# allowed_vlans_for_ib_mgmt_vnic : 4,3000,1202-1203 <--- works
# allowed_vlans_for_ib_mgmt_vnic : 1202-1203 <--- works
native_vlan_for_ib_mgmt_vnic : 1201 <--- works
# allowed_vlans_for_ib_mgmt_vnic : 1201,1203 <--- did not work
# allowed_vlans_for_ib_mgmt_vnic : 1201 <--- did not work
allowed_vlans_for_ib_mgmt_vnic : 1201,1203-1204 <--- works``
Ansible task referencing the above variables (and what worked or did not work is indicated above):
block:
- name: Print out type for VLANs
debug:
msg:
- "AllowedVlans: {{ allowed_vlans_for_ib_mgmt_vnic }} (type: {{ allowed_vlans_for_ib_mgmt_vnic | type_debug }})"
- "NativeVlan: {{ native_vlan_for_ib_mgmt_vnic }} (type: {{ native_vlan_for_ib_mgmt_vnic | type_debug }})"
- name: Configure Ethernet Network Group Policy for Red Hat OpenShift Cluster In-Band Management vNIC
cisco.intersight.intersight_rest_api:
<<: *api_info
resource_path: /fabric/EthNetworkGroupPolicies
query_params:
$filter: "Name eq '{{ name_of_ib_mgmt_eng_policy }}'"
api_body: {
"Name": "{{ name_of_ib_mgmt_eng_policy }}",
"Description": "{{ description_of_ib_mgmt_eng_policy }}",
"Organization": { "Moid": "{{ intersight_org.api_response.Moid }}"},
"VlanSettings": {
"NativeVlan": "{{ native_vlan_for_ib_mgmt_vnic }}",
"AllowedVlans": "{{ allowed_vlans_for_ib_mgmt_vnic }}"
},
"Tags": [{Key: "Provisioned by:", Value: "Intersight-Ansible"},{Key: "Project:", Value: "{{ prefix }}"}]
}
state: present
register: ib_mgmt_eng_policy`
Metadata
Metadata
Assignees
Labels
No labels