Red Hat Training

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

6.17. カスタムの Puppet 設定の適用

特定の状況では、追加のコンポーネントをオーバークラウドノードにインストールして設定する必要がある場合があります。これには、カスタムの Puppet マニフェストを使用して、主要な設定が完了してからノードに適用します。基本例として、各ノードに motd をインストールします。このインストールのプロセスでは、まず Heat テンプレート (/home/stack/templates/custom_puppet_config.yaml) を作成して、Puppet 設定を起動します。
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::SoftwareDeployments
    properties:
      config: {get_resource: ExtraPuppetConfig}
      servers: {get_param: servers}
これにより、テンプレート内に /home/stack/templates/motd.pp を含め、ノードが設定されるようにこのファイルを渡します。motd.pp ファイル自体には、motd をインストールして設定する Puppet クラスが含まれています。
次に、OS::TripleO::NodeExtraConfigPost: リソース種別として Heat テンプレートを登録する環境ファイル (/home/stack/templates/puppet_post_config.yaml) を作成します。
resource_registry:
  OS::TripleO::NodeExtraConfigPost: /home/stack/templates/custom_puppet_config.yaml
最後に、オーバークラウドのスタックが作成または更新されたら、この環境ファイルを含めます。
$ openstack overcloud deploy --templates -e /home/stack/templates/puppet_post_config.yaml
これにより、motd.pp からの設定がオーバークラウド内の全ノードに適用されます。