gushiren

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

虚机all in one环境测试安装heat

[root@armstrong ~]# tmux at -t mysql
MariaDB [(none)]> CREATE DATABASE heat;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' \
    ->   IDENTIFIED BY 'HEAT_DBPASS';
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [(none)]> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' \
    ->   IDENTIFIED BY 'HEAT_DBPASS';
Query OK, 0 rows affected (0.00 sec)
  
[root@armstrong ~]# source keystonerc_admin
  
创建heat用户
[root@armstrong ~(keystone_admin)]# openstack user create --domain default --password-prompt heat
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 0952d5ebdcaa43c288020364987503bf |
| name                | heat                             |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
将heat用户加入amdin角色 
[root@armstrong ~(keystone_admin)]# openstack role add --project services --user heat admin
  
创建heta和heat-cfb服务实体
[root@armstrong ~(keystone_admin)]# openstack service create --name heat --description "Orchestration" orchestration
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Orchestration                    |
| enabled     | True                             |
| id          | 3a423bcb425f4b0b814d53352eb2e16e |
| name        | heat                             |
| type        | orchestration                    |
+-------------+----------------------------------+
[root@armstrong ~(keystone_admin)]# openstack service create --name heat-cfn --description "Orchestration"  cloudformation
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Orchestration                    |
| enabled     | True                             |
| id          | 56672ffcfef14ffbbb041287e16bb0dd |
| name        | heat-cfn                         |
| type        | cloudformation                   |
+-------------+----------------------------------+
  
[root@armstrong ~(keystone_admin)]# openstack service list
+----------------------------------+-----------+----------------+
| ID                               | Name      | Type           |
+----------------------------------+-----------+----------------+
| 0bf0839f5a2a4a8d99450f0473403b32 | keystone  | identity       |
| 3a423bcb425f4b0b814d53352eb2e16e | heat      | orchestration  |
| 4542364e029e4a2cb7320b0338a21177 | cinderv2  | volumev2       |
| 50144c64d7bd44a5a3d0e9fb8473da37 | cinder    | volume         |
| 56672ffcfef14ffbbb041287e16bb0dd | heat-cfn  | cloudformation |
| 602a478cc2584269b24f7c0e9dda5c36 | glance    | image          |
| 807e8d2d91cc426cad435f907eb52601 | cinderv3  | volumev3       |
| 86d499b6413d4328969c82765f1f5044 | neutron   | network        |
| a4934bdd925f4cf9be7be020206c9751 | placement | placement      |
| e3c14c540fb54031a84ee2a5689c34ab | nova      | compute        |
+----------------------------------+-----------+----------------+
  
创建Orchestration endpoint
[root@armstrong nova(keystone_admin)]# openstack endpoint create --region RegionOne orchestration public http://192.168.122.209:8004/v1/%\(tenant_id\)s
+--------------+----------------------------------------------+
| Field        | Value                                        |
+--------------+----------------------------------------------+
| enabled      | True                                         |
| id           | 04710a3160c74386825b11595e13b10b             |
| interface    | public                                       |
| region       | RegionOne                                    |
| region_id    | RegionOne                                    |
| service_id   | 3a423bcb425f4b0b814d53352eb2e16e             |
| service_name | heat                                         |
| service_type | orchestration                                |
| url          | http://192.168.122.209:8004/v1/%(tenant_id)s |
+--------------+----------------------------------------------+
[root@armstrong nova(keystone_admin)]# openstack endpoint create --region RegionOne orchestration internal http://192.168.122.209:8004/v1/%\(tenant_id\)s
+--------------+----------------------------------------------+
| Field        | Value                                        |
+--------------+----------------------------------------------+
| enabled      | True                                         |
| id           | 3da6845f138f416196c420ee4a8c94bc             |
| interface    | internal                                     |
| region       | RegionOne                                    |
| region_id    | RegionOne                                    |
| service_id   | 3a423bcb425f4b0b814d53352eb2e16e             |
| service_name | heat                                         |
| service_type | orchestration                                |
| url          | http://192.168.122.209:8004/v1/%(tenant_id)s |
+--------------+----------------------------------------------+
[root@armstrong nova(keystone_admin)]# openstack endpoint create --region RegionOne orchestration admin http://192.168.122.209:8004/v1/%\(tenant_id\)s
+--------------+----------------------------------------------+
| Field        | Value                                        |
+--------------+----------------------------------------------+
| enabled      | True                                         |
| id           | f1bceb3152f747fb8e1244398a157090             |
| interface    | admin                                        |
| region       | RegionOne                                    |
| region_id    | RegionOne                                    |
| service_id   | 3a423bcb425f4b0b814d53352eb2e16e             |
| service_name | heat                                         |
| service_type | orchestration                                |
| url          | http://192.168.122.209:8004/v1/%(tenant_id)s |
+--------------+----------------------------------------------+
  
[root@armstrong nova(keystone_admin)]# openstack endpoint list |grep orchestration
+----------------------------------------------------------------------------------------------------------------------------------------------------+
| 04710a3160c74386825b11595e13b10b | RegionOne | heat         | orchestration | True    | public    | http://192.168.122.209:8004/v1/%(tenant_id)s   |
| 3da6845f138f416196c420ee4a8c94bc | RegionOne | heat         | orchestration | True    | internal  | http://192.168.122.209:8004/v1/%(tenant_id)s   |
| f1bceb3152f747fb8e1244398a157090 | RegionOne | heat         | orchestration | True    | admin     | http://192.168.122.209:8004/v1/%(tenant_id)s   |
+----------------------------------------------------------------------------------------------------------------------------------------------------+
 
 
 
创建cloudformation endpoint
[root@armstrong nova(keystone_admin)]# openstack endpoint create --region RegionOne cloudformation public http://192.168.122.209:8000/v1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | d6c3d5a7e57749d6a6e769d4fea77c67 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 56672ffcfef14ffbbb041287e16bb0dd |
| service_name | heat-cfn                         |
| service_type | cloudformation                   |
| url          | http://192.168.122.209:8000/v1   |
+--------------+----------------------------------+
[root@armstrong nova(keystone_admin)]# openstack endpoint create --region RegionOne cloudformation internal http://192.168.122.209:8000/v1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 4a7dd256dd044f37849ba08cdb12abf6 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 56672ffcfef14ffbbb041287e16bb0dd |
| service_name | heat-cfn                         |
| service_type | cloudformation                   |
| url          | http://192.168.122.209:8000/v1   |
+--------------+----------------------------------+
[root@armstrong nova(keystone_admin)]# openstack endpoint create --region RegionOne cloudformation admin http://192.168.122.209:8000/v1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 173892f7410a4dc4976ffe2a5adfb005 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 56672ffcfef14ffbbb041287e16bb0dd |
| service_name | heat-cfn                         |
| service_type | cloudformation                   |
| url          | http://192.168.122.209:8000/v1   |
+--------------+----------------------------------+
[root@armstrong nova(keystone_admin)]# openstack endpoint list |grep cloudformation
173892f7410a4dc4976ffe2a5adfb005 | RegionOne | heat-cfn     | cloudformation | True    | admin     | http://192.168.122.209:8000/v1                 4a7dd256dd044f37849ba08cdb12abf6 | RegionOne | heat-cfn     | cloudformation | True    | internal  | http://192.168.122.209:8000/v1                 d6c3d5a7e57749d6a6e769d4fea77c67 | RegionOne | heat-cfn     | cloudformation | True    | public    | http://192.168.122.209:8000/v1    
  
创建包含堆栈项目和用户的域
[root@armstrong nova(keystone_admin)]# openstack domain create --description "Stack projects and users" heat
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Stack projects and users         |
| enabled     | True                             |
| id          | 22388bd950cb495caf0b666dde11333e |
| name        | heat                             |
| tags        | []                               |
+-------------+----------------------------------+
 
创建heat_domain_admin用户来管理域中的项目和用户
[root@armstrong nova(keystone_admin)]# openstack user create --domain heat --password-prompt heat_domain_admin
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | 22388bd950cb495caf0b666dde11333e |
| enabled             | True                             |
| id                  | 0c858402292a4a8480715a213d563ccb |
| name                | heat_domain_admin                |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
 
 
将admin角色添加到域中的heat_domain_admin用户,通过heat_domain_admin用户启用管理堆栈管理权限
[root@armstrong nova(keystone_admin)]# openstack role add --domain heat --user-domain heat --user heat_domain_admin admin
  
创建heat_stack_owner角色
[root@armstrong nova(keystone_admin)]# openstack role create heat_stack_owner
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | e7523e56d0c14d8588c600567a8e95c8 |
| name      | heat_stack_owner                 |
+-----------+----------------------------------+
  
向demo项目和demo用户添加heat_stack_owner角色以启用演示用户的堆栈管理
[root@armstrong nova(keystone_admin)]# openstack role add --project demo --user demo heat_stack_owner
  
创建heat_stack_user角色
[root@armstrong nova(keystone_admin)]# openstack role create heat_stack_user
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | 49908672b7bc4d5699d053174b102ce1 |
| name      | heat_stack_user                  |
+-----------+----------------------------------+
  
安装和配置组件
[root@armstrong nova(keystone_admin)]#yum install openstack-heat-api openstack-heat-api-cfn openstack-heat-engine
 
编辑heat配置文件
cat /etc/heat/heat.conf
[DEFAULT]
transport_url = rabbit://guest:guest@192.168.122.209:5672
heat_metadata_server_url = http://192.168.122.209:8000
heat_waitcondition_server_url = http://192.168.122.209:8000/v1/waitcondition
stack_domain_admin = heat_domain_admin
stack_domain_admin_password = heat
stack_user_domain_name = heat
 
[database]
connection = mysql+pymysql://heat:HEAT_DBPASS@192.168.122.209/heat
 
[keystone_authtoken]
auth_uri = http://192.168.122.209:5000
auth_url = http://192.168.122.209:35357
memcached_servers = 192.168.122.209:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = services
username = heat
password = heat
 
[trustee]
auth_type = password
auth_url = http://192.168.122.209:35357
username = heat
password = heat
user_domain_name = default
 
[clients_keystone]
auth_uri = http://192.168.122.209:5000
  
  
同步数据库
[root@armstrong nova(keystone_admin)]# su -s /bin/sh -c "heat-manage db_sync" heat
2018-06-13 09:55:42.367 15830 WARNING oslo_config.cfg [-] Option "db_backend" from group "DEFAULT" is deprecated. Use option "backend" from group "database".2018-06-13 09:55:42.495 15830 INFO migrate.versioning.api [-] 70 -> 71...
2018-06-13 09:55:42.727 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.727 15830 INFO migrate.versioning.api [-] 71 -> 72...
2018-06-13 09:55:42.761 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.762 15830 INFO migrate.versioning.api [-] 72 -> 73...
2018-06-13 09:55:42.804 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.804 15830 INFO migrate.versioning.api [-] 73 -> 74...
2018-06-13 09:55:42.810 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.810 15830 INFO migrate.versioning.api [-] 74 -> 75...
2018-06-13 09:55:42.815 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.815 15830 INFO migrate.versioning.api [-] 75 -> 76...
2018-06-13 09:55:42.821 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.821 15830 INFO migrate.versioning.api [-] 76 -> 77...
2018-06-13 09:55:42.826 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.826 15830 INFO migrate.versioning.api [-] 77 -> 78...
2018-06-13 09:55:42.833 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.834 15830 INFO migrate.versioning.api [-] 78 -> 79...
2018-06-13 09:55:42.940 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.940 15830 INFO migrate.versioning.api [-] 79 -> 80...
2018-06-13 09:55:42.992 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.992 15830 INFO migrate.versioning.api [-] 80 -> 81...
2018-06-13 09:55:42.997 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:42.997 15830 INFO migrate.versioning.api [-] 81 -> 82...
2018-06-13 09:55:43.002 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:43.002 15830 INFO migrate.versioning.api [-] 82 -> 83...
2018-06-13 09:55:43.007 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:43.007 15830 INFO migrate.versioning.api [-] 83 -> 84...
2018-06-13 09:55:43.012 15830 INFO migrate.versioning.api [-] done
2018-06-13 09:55:43.013 15830 INFO migrate.versioning.api [-] 84 -> 85...
2018-06-13 09:55:43.017 15830 INFO migrate.versioning.api [-] done
  
启动服务
[root@armstrong nova(keystone_admin)]# systemctl enable openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-heat-api.service to /usr/lib/systemd/system/openstack-heat-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-heat-api-cfn.service to /usr/lib/systemd/system/openstack-heat-api-cfn.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-heat-engine.service to /usr/lib/systemd/system/openstack-heat-engine.service.
[root@armstrong nova(keystone_admin)]# systemctl start openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
  
          
验证服务状态
[root@armstrong heat(keystone_admin)]#source keystonerc_admin
[root@armstrong ~(keystone_admin)]# openstack orchestration service list
+-----------+-------------+--------------------------------------+-----------+--------+----------------------------+--------+
| Hostname  | Binary      | Engine ID                            | Host      | Topic  | Updated At                 | Status |
+-----------+-------------+--------------------------------------+-----------+--------+----------------------------+--------+
| armstrong | heat-engine | 7953d573-ebb6-4bc9-804a-5fff4f44a71a | armstrong | engine | 2018-06-13T03:39:28.000000 | up     |
| armstrong | heat-engine | 88b6c902-09fe-46fb-87a0-6baf762a8ad3 | armstrong | engine | 2018-06-13T03:37:01.000000 | down   |
| armstrong | heat-engine | c81c847b-45e3-46ec-8c6a-d32b61dcfe11 | armstrong | engine | 2018-06-13T03:39:28.000000 | up     |
| armstrong | heat-engine | ab960cdb-3633-4ab2-a93d-86f74bfb7179 | armstrong | engine | 2018-06-13T03:37:01.000000 | down   |
| armstrong | heat-engine | 0b7a2c59-7cdf-47e8-a58b-06aa11556682 | armstrong | engine | 2018-06-13T03:37:01.000000 | down   |
| armstrong | heat-engine | 6cf3b8df-391b-4937-b37e-856b9d7cd0ef | armstrong | engine | 2018-06-13T03:37:01.000000 | down   |
| armstrong | heat-engine | 6fbad63a-e6fa-4868-9c04-7e6c0cca2b2e | armstrong | engine | 2018-06-13T03:39:28.000000 | up     |
| armstrong | heat-engine | b55005dc-cf1e-455c-b5b0-20aa46bf1340 | armstrong | engine | 2018-06-13T03:39:28.000000 | up     |
+-----------+-------------+--------------------------------------+-----------+--------+----------------------------+--------+
  
验证支持的resource type
[root@armstrong ~(keystone_admin)]# openstack orchestration resource type list
+------------------------------------------+
| Resource Type                            |
+------------------------------------------+
| AWS::AutoScaling::AutoScalingGroup       |
| AWS::AutoScaling::LaunchConfiguration    |
| AWS::AutoScaling::ScalingPolicy          |
| AWS::CloudFormation::Stack               |
| AWS::CloudFormation::WaitCondition       |
| AWS::CloudFormation::WaitConditionHandle |
| AWS::CloudWatch::Alarm                   |
| AWS::EC2::EIP                            |
| AWS::EC2::EIPAssociation                 |
| AWS::EC2::Instance                       |
| AWS::EC2::InternetGateway                |
| AWS::EC2::NetworkInterface               |
| AWS::EC2::RouteTable                     |
| AWS::EC2::SecurityGroup                  |
| AWS::EC2::Subnet                         |
| AWS::EC2::SubnetRouteTableAssociation    |
| AWS::EC2::VPC                            |
| AWS::EC2::VPCGatewayAttachment           |
| AWS::EC2::Volume                         |
| AWS::EC2::VolumeAttachment               |
| AWS::ElasticLoadBalancing::LoadBalancer  |
| AWS::IAM::AccessKey                      |
| AWS::IAM::User                           |
| AWS::RDS::DBInstance                     |
| OS::Cinder::EncryptedVolumeType          |
| OS::Cinder::QoSAssociation               |
| OS::Cinder::QoSSpecs                     |
| OS::Cinder::Quota                        |
| OS::Cinder::Volume                       |
| OS::Cinder::VolumeAttachment             |
| OS::Cinder::VolumeType                   |
| OS::Glance::Image                        |
| OS::Heat::AccessPolicy                   |
| OS::Heat::AutoScalingGroup               |
| OS::Heat::CloudConfig                    |
| OS::Heat::DeployedServer                 |
| OS::Heat::InstanceGroup                  |
| OS::Heat::MultipartMime                  |
| OS::Heat::None                           |
| OS::Heat::RandomString                   |
| OS::Heat::ResourceChain                  |
| OS::Heat::ResourceGroup                  |
| OS::Heat::ScalingPolicy                  |
| OS::Heat::SoftwareComponent              |
| OS::Heat::SoftwareConfig                 |
| OS::Heat::SoftwareDeployment             |
| OS::Heat::SoftwareDeploymentGroup        |
| OS::Heat::Stack                          |
| OS::Heat::StructuredConfig               |
| OS::Heat::StructuredDeployment           |
| OS::Heat::StructuredDeploymentGroup      |
| OS::Heat::TestResource                   |
| OS::Heat::UpdateWaitConditionHandle      |
| OS::Heat::Value                          |
| OS::Heat::WaitCondition                  |
| OS::Heat::WaitConditionHandle            |
| OS::Keystone::Domain                     |
| OS::Keystone::Endpoint                   |
| OS::Keystone::Group                      |
| OS::Keystone::GroupRoleAssignment        |
| OS::Keystone::Project                    |
| OS::Keystone::Region                     |
| OS::Keystone::Role                       |
| OS::Keystone::Service                    |
| OS::Keystone::User                       |
| OS::Keystone::UserRoleAssignment         |
| OS::Neutron::AddressScope                |
| OS::Neutron::ExtraRoute                  |
| OS::Neutron::FloatingIP                  |
| OS::Neutron::FloatingIPAssociation       |
| OS::Neutron::FlowClassifier              |
| OS::Neutron::MeteringLabel               |
| OS::Neutron::MeteringRule                |
| OS::Neutron::Net                         |
| OS::Neutron::NetworkGateway              |
| OS::Neutron::Port                        |
| OS::Neutron::PortPair                    |
| OS::Neutron::ProviderNet                 |
| OS::Neutron::QoSBandwidthLimitRule       |
| OS::Neutron::QoSDscpMarkingRule          |
| OS::Neutron::QoSPolicy                   |
| OS::Neutron::Quota                       |
| OS::Neutron::RBACPolicy                  |
| OS::Neutron::Router                      |
| OS::Neutron::RouterInterface             |
| OS::Neutron::SecurityGroup               |
| OS::Neutron::SecurityGroupRule           |
| OS::Neutron::Subnet                      |
| OS::Neutron::SubnetPool                  |
| OS::Neutron::Trunk                       |
| OS::Nova::Flavor                         |
| OS::Nova::FloatingIP                     |
| OS::Nova::FloatingIPAssociation          |
| OS::Nova::HostAggregate                  |
| OS::Nova::KeyPair                        |
| OS::Nova::Quota                          |
| OS::Nova::Server                         |
| OS::Nova::ServerGroup                    |
| OS::Senlin::Cluster                      |
| OS::Senlin::Node                         |
| OS::Senlin::Policy                       |
| OS::Senlin::Profile                      |
| OS::Senlin::Receiver                     |
+------------------------------------------+
  
验证模板版本
[root@armstrong ~(keystone_admin)]# openstack orchestration template version list
+--------------------------------------+------+------------------------------+
| Version                              | Type | Aliases                      |
+--------------------------------------+------+------------------------------+
| AWSTemplateFormatVersion.2010-09-09  | cfn  |                              |
| HeatTemplateFormatVersion.2012-12-12 | cfn  |                              |
| heat_template_version.2013-05-23     | hot  |                              |
| heat_template_version.2014-10-16     | hot  |                              |
| heat_template_version.2015-04-30     | hot  |                              |
| heat_template_version.2015-10-15     | hot  |                              |
| heat_template_version.2016-04-08     | hot  |                              |
| heat_template_version.2016-10-14     | hot  | heat_template_version.newton |
| heat_template_version.2017-02-24     | hot  | heat_template_version.ocata  |
| heat_template_version.2017-09-01     | hot  | heat_template_version.pike   |
| heat_template_version.2018-03-02     | hot  | heat_template_version.queens |
+--------------------------------------+------+------------------------------+

 

posted on 2018-08-21 15:31  gushiren  阅读(333)  评论(0编辑  收藏  举报