Hi all, I figured out another way to do this by just using different variable names and then passing them back through, eg for ‘aoscx_vsx.keepalive_peer_ip’ I just create a new var at the most specific level in the group_vars or host_vars file and then map it in the more general vars file. I think this is what akira suggested with flattened variables, but I was too much of a noob to understand that a few weeks ago!
host_vars/core01.yml
ka_peer_ip: 10.0.0.2
ka_src_ip: 10.0.0.1
host_vars/core02.yml
ka_peer_ip: 10.0.0.1
ka_src_ip: 10.0.0.2
group_vars/switches.yml
aoscx_vsx:
isl_port: lag99
keepalive_peer_ip: "{{ ka_peer_ip }}"
keepalive_src_ip: "{{ ka_src_ip }}"
system_mac: 00:FF:11:EE:22:DD
Thanks again everyone for your help, I’m learning
I do, however, have a new question on the same subject.
This time it’s for Dell OS10 switches rather than Aruba and I’m configuring VLANs and ports as shown below. I define ‘nicprefix’ so I can change this on different switches, in this case the servers all have their OCP NICs connected to one switch and their PCI NICs connected to another, so I set ‘nicprefix: PCI’ on the second switch. So the snippet below works perfectly to create a couple of VLANs and set the appropriate interfaces to be tagged -
host_vars/labsw1.yml
nicprefix: OCP
portgroup01range: 1/1/1-1/1/8
portgroup01desc: "{{ nicprefix }}1-VM-Mgmt-vMotion"
#
os10_vlan:
# VM Mgmt
vlan 50:
vlan-name: V0050-ESXi
state: present
tagged_members:
- port: range ethernet {{ portgroup01range }},{{ portgroup09range }}
desc: V0050-ESXi
state: present
access_vlan: "false"
# VM vMotion
vlan "{{vlan-vMotion}}" :
state: present
tagged_members:
- port: range ethernet {{ portgroup01range }}
desc: V0203-vMotion
state: present
access_vlan: "false"
# Dell S4148 switch -
labsw1# show vlan
Codes: * - Default VLAN, M - Management VLAN, R - Remote Port Mirroring VLANs,
@ - Attached to Virtual Network, P - Primary, C - Community, I - Isolated,
S - VLAN-Stack VLAN
Q: A - Access (Untagged), T - Tagged
NUM Status Description Q Ports
50 Inactive T Eth1/1/1-1/1/10
203 Inactive T Eth1/1/1-1/1/8
But when I come to set the interface descriptions the yml below does not work and I get the error shown below -
host_vars/labsw1.yml
#
os10_interface:
range ethernet "{{ portgroup01range }}":
desc: "{{ portgroup01desc }}"
TASK [dellemc.os10.os10_interface : Provisioning interface configuration for os10] ********************************************************************************************
fatal: [labsw1]: FAILED! => {
"changed": false,
"command": "interface range ethernet\"{{",
"rc": -32603
}
MSG:
interface range "ethernet{{
% Error: Illegal parameter.
labsw1(conf-range-eth1/1/28-1/1/30)#
but this works fine -
os10_interface:
range ethernet 1/1/1-1/1/8:
desc: "{{ portgroup01desc }}"
I get the same if I try to replace VLAN numbers with vars -
vlan_vMotion: 203
os10_vlan:
# VM vMotion
vlan "{{vlan_vMotion}}" :
state: present
tagged_members:
- port: range ethernet {{ portgroup01range }}
desc: V0203-vMotion
state: present
access_vlan: "false"
TASK [dellemc.os10.os10_vlan : Provisioning VLAN configuration for os10] ******************************************************************************************************
fatal: [labsw1]: FAILED! => {
"changed": false,
"command": "interface vlan\"{{",
"rc": -32603
}
MSG:
interface vlan"{{
% Error: Illegal parameter.
labsw1(conf-if-po-47)#
Does anyone have any ideas?
Thanks,
Mike