10.6. 自定义网络的网络接口模板注意事项
当您使用可组合网络时,process-templates.py 脚本会使静态模板包含在 network_data.yaml 和 roles_data.yaml 文件中定义的网络和角色。确保您的渲染的 NIC 模板包含以下项目:
- 每个角色的静态文件,包括自定义可组合网络。
- 每个角色的静态文件中的正确网络定义。
每个静态文件都需要任何自定义网络的所有参数定义,即使网络没有在角色中使用。确保呈现的模板包含这些参数。例如,如果您只向 Ceph 节点添加 StorageBackup 网络,还必须将该定义包含在所有角色的 NIC 配置模板中的 parameter 部分:
parameters:
...
StorageBackupIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
...
如果需要,您还可以包括 VLAN ID 和/或网关 IP 的 parameters 定义:
parameters:
...
StorageBackupNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
StorageBackupDefaultRoute:
description: The default route of the storage backup network.
type: string
...
自定义网络的 IpSubnet 参数会出现在每个角色的参数定义中。但是,由于 Ceph 角色可能是唯一使用 StorageBackup 网络的角色,因此只有 Ceph 角色的 NIC 配置模板会使用模板的 network_config 部分中的 StorageBackup 参数。
$network_config:
network_config:
- type: interface
name: nic1
use_dhcp: false
addresses:
- ip_netmask:
get_param: StorageBackupIpSubnet