赞
踩
鄙人不才,曾有幸准备过安徽省技能大赛云计算赛项的比赛,在openstack进行heat运维时,经常会忘记资源名,在官网偶然发现了可以快速查询的方法
新开一个终端,source一下openstack权限
在命令行中输入openstack按回车,命令行变成(openstack)
输入o按TAB补全,输入想要的内容
orchestration resource type list 列出heat模板 type属性的值
orchestration template version list 列出 heat模板的所有可用版本值
orchestration resource type show #查询heat模板来源的值,类似于k8s 的explain
使用方法
orchestration resource type show type类型
例如:查询flavor所有可填属性
orchestration resource type show OS::Nova::Flavor
注意: 凡是属性中的required字段的值为true的为必填字段
示例:
1.使用heat编排的yaml创建一个名为m1.flavor,ID为1234,内存为1024MB,硬盘为10GB ,vcpu数量为2的云主机类型
heat_template_version: 2015-04-30
resources:
flavor:
type: OS::Nova::Flavor
properties:
flavorid: 1234
name: m1.flavor
vcpus: 2
ram: 1024
disk: 10
2.创建内网及其子网
heat_template_version: 2013-05-23
resources:
heat-network:
type: OS::Neutron::ProviderNet
properties:
shared: False
network_type: vlan
subnet:
type: OS::Neutron::Subnet
properties:
name: heat-subnet
ip_version: 4
cidr: 10.10.10.0/24
network: {"Ref": heat-network}
3.创建外网及其子网
heat_template_version: 2013-05-23 resources: heat-network: type: OS::Neutron::ProviderNet properties: physical_network: provider shared: false network_type: flat router_external: true heat-subnet: type: OS::Neutron::Subnet properties: name: heat-subnet ip_version: 4 cidr: 192.168.10.20/24 network: {"Ref": heat-network} # 父网络
同时创建网络和子网的heat模板正确答案
4.创建镜像
swift post test #创建一个test容器
swift upload test 镜像地址 # 向test容器上传容器
打开openstack平台打开公开访问 复制地址
5.创建user
heat_template_version: 2015-04-30
resources:
user:
type: OS::Keystone::User
properties:
domain: demo #所在域
name: wang
password: 000000
enabled: true # 是否启用此用户
参考资料
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。