6.2.6. 新規ロールの作成
以下の例は、OpenStack Dashboard (horizon) のみをホストする新しい Horizon ロールを作成することを目的としています。このような場合には、新規ロールの情報が含まれるカスタムの roles ディレクトリーを作成します。
デフォルトの roles ディレクトリーのカスタムコピーを作成します。
$ cp -r /usr/share/openstack-tripleo-heat-templates/roles ~/.
~/roles/Horizon.yaml という名前の新規ファイルを作成して、ベースおよびコアの OpenStack Dashboard サービスが含まれた Horizon ロールを新規作成します。以下に例を示します。
- name: Horizon
CountDefault: 1
HostnameFormatDefault: '%stackname%-horizon-%index%'
ServicesDefault:
- OS::TripleO::Services::CACerts
- OS::TripleO::Services::Kernel
- OS::TripleO::Services::Ntp
- OS::TripleO::Services::Snmp
- OS::TripleO::Services::Sshd
- OS::TripleO::Services::Timezone
- OS::TripleO::Services::TripleoPackages
- OS::TripleO::Services::TripleoFirewall
- OS::TripleO::Services::SensuClient
- OS::TripleO::Services::FluentdClient
- OS::TripleO::Services::AuditD
- OS::TripleO::Services::Collectd
- OS::TripleO::Services::MySQLClient
- OS::TripleO::Services::Apache
- OS::TripleO::Services::Horizon
CountDefault を 1 に設定して、デフォルトのオーバークラウドに常に Horizon ノードが含まれるようにすると良いでしょう。
既存のオーバークラウド内でサービスをスケーリングする場合には、既存のサービスを Controller ロール上に保持します。新規オーバークラウドを作成して、OpenStack Dashboard がスタンドアロンのロールに残るようにするには、Controller ロールの定義から OpenStack Dashboard コンポーネントを削除します。
- name: Controller
CountDefault: 1
ServicesDefault:
...
- OS::TripleO::Services::GnocchiMetricd
- OS::TripleO::Services::GnocchiStatsd
- OS::TripleO::Services::HAproxy
- OS::TripleO::Services::HeatApi
- OS::TripleO::Services::HeatApiCfn
- OS::TripleO::Services::HeatApiCloudwatch
- OS::TripleO::Services::HeatEngine
# - OS::TripleO::Services::Horizon # Remove this service
- OS::TripleO::Services::IronicApi
- OS::TripleO::Services::IronicConductor
- OS::TripleO::Services::Iscsid
- OS::TripleO::Services::Keepalived
...
roles ディレクトリーをソースに使用して、新しい roles_data ファイルを生成します。
$ openstack overcloud roles generate -o roles_data-horizon.yaml \
--roles-path ~/roles \
Controller Compute Horizon
このロールに新しいフレーバーを定義して、特定のノードをタグ付けできるようにする必要がある場合があります。この例では、以下のコマンドを使用して horizon フレーバーを作成します。
$ openstack flavor create --id auto --ram 6144 --disk 40 --vcpus 4 horizon
$ openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" --property "capabilities:profile"="horizon" horizon
$ openstack flavor set --property resources:VCPU=0 --property resources:MEMORY_MB=0 --property resources:DISK_GB=0 --property resources:CUSTOM_BAREMETAL=1 horizon
以下のコマンドを実行して、ノードを新規フレーバーにタグ付けします。
$ openstack baremetal node set --property capabilities='profile:horizon,boot_option:local' 58c3d07e-24f2-48a7-bbb6-6843f0e8ee13
以下の環境ファイルのスニペットを使用して、Horizon ノードの数とフレーバーを定義します。
parameter_defaults:
OvercloudHorizonFlavor: horizon
HorizonCount: 1
openstack overcloud deploy コマンドの実行時には、新しい roles_data ファイルと環境ファイルを指定します。以下に例を示します。
$ openstack overcloud deploy --templates -r ~/templates/roles_data-horizon.yaml -e ~/templates/node-count-flavor.yaml
デプロイメントが完了すると、コントローラーノードが 1 台、コンピュートノードが 1 台、ネットワーカーノードが 1 台の 3 ノード構成のオーバークラウドが作成されます。オーバークラウドのノード一覧を表示するには、以下のコマンドを実行します。
$ openstack server list