Red Hat Training

A Red Hat training course is available for Red Hat OpenStack Platform

11.2. 为自定义呈现默认网络接口模板

为简化自定义模板的配置,请呈现默认 NIC 模板的 Jinja2 语法,并使用渲染的模板作为自定义配置的基础。

流程

  1. 使用 process-templates.py 脚本呈现 openstack-tripleo-heat-templates 集合的副本:

    $ cd /usr/share/openstack-tripleo-heat-templates
    $ ./tools/process-templates.py -o ~/openstack-tripleo-heat-templates-rendered

    这会将所有 Jinja2 模板转换为其呈现的 YAML 版本,并将结果保存到 ~/openstack-tripleo-heat-templates-rendered 中。

    如果使用自定义网络文件或自定义角色文件,您可以使用 -n-r 选项分别包含这些文件。例如:

    $ ./tools/process-templates.py -o ~/openstack-tripleo-heat-templates-rendered -n /home/stack/network_data.yaml -r /home/stack/roles_data.yaml
  2. 复制多个 NIC 示例:

    $ cp -r ~/openstack-tripleo-heat-templates-rendered/network/config/multiple-nics/ ~/templates/custom-nics/
  3. 您可以编辑 custom-nics 中设置的模板,以适应您自己的网络配置。