Red Hat Training
A Red Hat training course is available for Red Hat OpenStack Platform
4.7. Puppet:应用自定义清单
在某些情况下,您可能需要为 Overcloud 节点安装和配置一些额外的组件。您可以通过一个自定义 Puppet 清单来实现此目的,该清单在主配置完成后应用到节点上的节点。作为基本示例,您可能打算将 motd 安装到每个节点。完成的过程是首先创建一个启动 Puppet 配置的 Heat 模板(/home/stack/templates/custom_puppet_config.yaml)。
heat_template_version: 2014-10-16
description: >
Run Puppet extra configuration to set new MOTD
parameters:
servers:
type: json
resources:
ExtraPuppetConfig:
type: OS::Heat::SoftwareConfig
properties:
config: {get_file: motd.pp}
group: puppet
options:
enable_hiera: True
enable_facter: False
ExtraPuppetDeployments:
type: OS::Heat::SoftwareDeploymentGroup
properties:
config: {get_resource: ExtraPuppetConfig}
servers: {get_param: servers}
这包括模板中的 /home/stack/templates/motd.pp,并将它传递给节点以进行配置。motd.pp 文件本身包含用于安装和配置 motd 的 Puppet 类。
接下来,创建一个环境文件(/home/stack/templates/puppet_post_config.yaml),将 heat 模板注册为 OS::TripleO::NodeExtraConfigPost: 资源类型。
resource_registry: OS::TripleO::NodeExtraConfigPost: /home/stack/templates/custom_puppet_config.yaml
最后,在创建或更新 Overcloud 堆栈时,将此环境文件与其他环境文件一起包含:
$ openstack overcloud deploy --templates \
...
-e /home/stack/templates/puppet_post_config.yaml \
...
这会将 motd.pp 的配置应用到 Overcloud 中的所有节点。