2.6. 创建新角色
您可以根据部署的要求,使用可组合服务架构将角色分配给裸机节点。例如,您可能希望创建新的 Horizon
角色来仅托管 OpenStack 控制面板(horizon
)。
流程
-
以
stack
用户的身份登录 undercloud。 Source
stackrc
文件:[stack@director ~]$ source ~/stackrc
将
roles
目录从核心 heat 模板集合复制到stack
用户的主目录:$ cp -r /usr/share/openstack-tripleo-heat-templates/roles/. /home/stack/templates/roles/
-
在
home/stack/templates/roles
中创建一个名为Horizon.yaml
的新文件。 在
Horizon.yaml
中添加以下配置,以创建一个包含基本和核心 OpenStack Dashboard 服务的新Horizon
角色:- name: Horizon 1 CountDefault: 1 2 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
可选:如果要在现有 overcloud 中扩展服务,请在
Controller
角色上保留现有服务。如果要创建新 overcloud,并且希望 OpenStack 控制面板保留在独立角色上,请从Controller
角色定义中删除 OpenStack 仪表板组件:- 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_data_horizon.yaml
的新角色数据文件,其中包含Controller
、Compute
和Horizon
角色:(undercloud)$ openstack overcloud roles \ generate -o /home/stack/templates/roles_data_horizon.yaml \ --roles-path /home/stack/templates/roles \ Controller Compute Horizon
可选:编辑
overcloud-baremetal-deploy.yaml
节点定义文件以配置 Horizon 节点的放置:- name: Controller count: 3 instances: - hostname: overcloud-controller-0 name: node00 ... - name: Compute count: 3 instances: - hostname: overcloud-novacompute-0 name: node04 ... - name: Horizon count: 1 instances: - hostname: overcloud-horizon-0 name: node07