4.2. 创建角色数据文件
要为每个叶定义每个可组合角色,并将可组合网络附加到每个对应的角色,请完成以下步骤。
流程
在
stack用户的主目录中创建自定义角色目录:$ mkdir ~/roles将默认的 Controller、Compute 和 Ceph Storage 角色从 director 核心模板集合复制到 roles 目录。重命名 Compute 和 Ceph Storage 的文件以适合 Leaf 0 :
$ cp /usr/share/openstack-tripleo-heat-templates/roles/Controller.yaml ~/roles/Controller.yaml $ cp /usr/share/openstack-tripleo-heat-templates/roles/Compute.yaml ~/roles/Compute0.yaml $ cp /usr/share/openstack-tripleo-heat-templates/roles/CephStorage.yaml ~/roles/CephStorage0.yaml复制 Leaf 0 Compute 和 Ceph Storage 文件作为您的 Leaf 1 和 Leaf 2 文件的基础:
$ cp ~/roles/Compute0.yaml ~/roles/Compute1.yaml $ cp ~/roles/Compute0.yaml ~/roles/Compute2.yaml $ cp ~/roles/CephStorage0.yaml ~/roles/CephStorage1.yaml $ cp ~/roles/CephStorage0.yaml ~/roles/CephStorage2.yaml编辑 Leaf 0, Leaf 1, 和 Leaf 2 文件中的
name,HostnameFormatDefault, anddeprecated_nic_config_name参数,以便它们与对应的 Leaf 参数一致。例如,Leaf 0 Compute 文件中的参数具有以下值:- name: ComputeLeaf0 HostnameFormatDefault: '%stackname%-compute-leaf0-%index%' deprecated_nic_config_name: 'computeleaf0.yaml'Leaf 0 Ceph Storage 参数具有以下值:
- name: CephStorageLeaf0 HostnameFormatDefault: '%stackname%-cephstorage-leaf0-%index%' deprecated_nic_config_name: 'ceph-strorageleaf0.yaml'编辑 Leaf 1 和 Leaf 2 文件中的
network参数,以便它们与相应的 Leaf 网络参数保持一致。例如,Leaf 1 Compute 文件中的参数具有以下值:- name: ComputeLeaf1 networks: InternalApi: subnet: internal_api_leaf1 Tenant: subnet: tenant_leaf1 Storage: subnet: storage_leaf1Leaf 1 Ceph Storage 参数具有以下值:
- name: CephStorageLeaf1 networks: Storage: subnet: storage_leaf1 StorageMgmt: subnet: storage_mgmt_leaf1注意这只适用于 Leaf 1 和 Leaf 2。Leaf 0 的
network参数保留基本子网值,这些值是每个子网的小写名称再加上一个_subnet后缀。例如,Leaf 0 的内部 API 是internal_api_subnet。角色配置完成后,运行以下命令来生成完整的角色数据文件:
$ openstack overcloud roles generate --roles-path ~/roles -o roles_data_spine_leaf.yaml Controller Compute Compute1 Compute2 CephStorage CephStorage1 CephStorage2这会创建一个完整的
roles_data_spine_leaf.yaml文件,其中包含每个对应叶网络的所有自定义角色。
每个角色都有自己的 NIC 配置。在配置 spine-leaf 配置前,您必须创建一个基本 NIC 模板集合来适合您的当前 NIC 配置。