heat模板快速查找资源对象(离线版)

heat模板快速查找资源对象(离线版)

鄙人不才,曾有幸准备过安徽省技能大赛云计算赛项的比赛,在openstack进行heat运维时,经常会忘记资源名,在官网偶然发现了可以快速查询的方法

一.在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的为必填字段

示例:

5209530119097eee311763d9dfcb1323

二.heat模板部分总结

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模板正确答案

image-20220908125830972


4.创建镜像

swift post test #创建一个test容器
swift upload test 镜像地址  # 向test容器上传容器
打开openstack平台打开公开访问 复制地址

8c030b043532f907eb50f2cfd98ea0f0

5.创建user

heat_template_version: 2015-04-30
resources:
  user:
    type: OS::Keystone::User
    properties:
      domain: demo #所在域
      name: wang
      password: 000000
      enabled: true # 是否启用此用户

参考资料

OpenStack Heat模板案例实操手册

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值