openstack安装配置—— orchestration安装配置

    如果一次需要启动10个实例,手动一个一个的去套模版启动,相信也行太low了吧,openstack官方也为运维人员准备了强大的利器,那就是任务编排orchestration服务模块了,当然如果要想用好这一工具来帮我解决低级趣味的任务编排,还需要我们专业去学习一下heat模版语法了,在这里我只是带大家简单实现一下通过任务编排模版自动创建并启动一个实例,具体语法规则不这里不详细陈述。

controller节点安装配置

准备数据库

[[email protected] ~]# mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 5960

Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE heat;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON heat.* TO ‘heat‘@‘localhost‘ \

->   IDENTIFIED BY ‘HEAT_DBPASS‘;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON heat.* TO ‘heat‘@‘%‘ \

->   IDENTIFIED BY ‘HEAT_DBPASS‘;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit

Bye

[[email protected] ~]#

创建用户并授权为管理员

[[email protected] ~]# . admin-openrc

[[email protected] ~]# openstack user create --domain default --password-prompt heat

User Password:

Repeat User Password:

+-----------+----------------------------------+

| Field     | Value                            |

+-----------+----------------------------------+

| domain_id | 3ad6ac5f704c494e9f16b9e04ef745fe |

| enabled   | True                             |

| id        | f565ccc8e39148acaaa215c1b2afa796 |

| name      | heat                             |

+-----------+----------------------------------+

[[email protected] ~]# openstack role add --project service --user heat admin

[[email protected] ~]#

创建 heat 和 heat-cfn 服务

[[email protected] ~]# openstack service create --name heat \

>   --description "Orchestration" orchestration

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description | Orchestration                    |

| enabled     | True                             |

| id          | 9c6f28bceaed4e509a714422c0020add |

| name        | heat                             |

| type        | orchestration                    |

+-------------+----------------------------------+

[[email protected] ~]# openstack service create --name heat-cfn \

>   --description "Orchestration"  cloudformation

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description | Orchestration                    |

| enabled     | True                             |

| id          | 7e795b3ac8274b19ab02ce10ad76f0f5 |

| name        | heat-cfn                         |

| type        | cloudformation                   |

+-------------+----------------------------------+

[[email protected] ~]#

创建 Orchestration 服务的 API接口

[[email protected] ~]# openstack endpoint create --region RegionOne \

>   orchestration public http://controller:8004/v1/%\(tenant_id\)s

+--------------+-----------------------------------------+

| Field        | Value                                   |

+--------------+-----------------------------------------+

| enabled      | True                                    |

| id           | 77ae53a11b8d4b49a40280cd1ee06156        |

| interface    | public                                  |

| region       | RegionOne                               |

| region_id    | RegionOne                               |

| service_id   | 9c6f28bceaed4e509a714422c0020add        |

| service_name | heat                                    |

| service_type | orchestration                           |

| url          | http://controller:8004/v1/%(tenant_id)s |

+--------------+-----------------------------------------+

[[email protected] ~]# openstack endpoint create --region RegionOne \

>   orchestration internal http://controller:8004/v1/%\(tenant_id\)s

+--------------+-----------------------------------------+

| Field        | Value                                   |

+--------------+-----------------------------------------+

| enabled      | True                                    |

| id           | dd7de2064e684728b6296628e3b48adc        |

| interface    | internal                                |

| region       | RegionOne                               |

| region_id    | RegionOne                               |

| service_id   | 9c6f28bceaed4e509a714422c0020add        |

| service_name | heat                                    |

| service_type | orchestration                           |

| url          | http://controller:8004/v1/%(tenant_id)s |

+--------------+-----------------------------------------+

[[email protected] ~]# openstack endpoint create --region RegionOne \

>   orchestration admin http://controller:8004/v1/%\(tenant_id\)s

+--------------+-----------------------------------------+

| Field        | Value                                   |

+--------------+-----------------------------------------+

| enabled      | True                                    |

| id           | 61eedfaf02d54a06ba8dfeed253bdaae        |

| interface    | admin                                   |

| region       | RegionOne                               |

| region_id    | RegionOne                               |

| service_id   | 9c6f28bceaed4e509a714422c0020add        |

| service_name | heat                                    |

| service_type | orchestration                           |

| url          | http://controller:8004/v1/%(tenant_id)s |

+--------------+-----------------------------------------+

[[email protected] ~]#

[[email protected] ~]# openstack endpoint create --region RegionOne \

>   cloudformation public http://controller:8000/v1

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | 23cc7aac12964ffe992ce1e46e5fd1a7 |

| interface    | public                           |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | 7e795b3ac8274b19ab02ce10ad76f0f5 |

| service_name | heat-cfn                         |

| service_type | cloudformation                   |

| url          | http://controller:8000/v1        |

+--------------+----------------------------------+

[[email protected] ~]# openstack endpoint create --region RegionOne \

>   cloudformation internal http://controller:8000/v1

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | c1cdaee0d73b4006926777e39f10e839 |

| interface    | internal                         |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | 7e795b3ac8274b19ab02ce10ad76f0f5 |

| service_name | heat-cfn                         |

| service_type | cloudformation                   |

| url          | http://controller:8000/v1        |

+--------------+----------------------------------+

[[email protected] ~]# openstack endpoint create --region RegionOne \

>   cloudformation admin http://controller:8000/v1

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | 837f4cb29c2741cf9b23dbaffe6d39f1 |

| interface    | admin                            |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | 7e795b3ac8274b19ab02ce10ad76f0f5 |

| service_name | heat-cfn                         |

| service_type | cloudformation                   |

| url          | http://controller:8000/v1        |

+--------------+----------------------------------+

[[email protected] ~]#

为栈创建 heat 包含项目和用户的域

[[email protected] ~]# openstack domain create --description "Stack projects and users" heat

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description | Stack projects and users         |

| enabled     | True                             |

| id          | dbb18adb37e74e78bb5165f14efa3a25 |

| name        | heat                             |

+-------------+----------------------------------+

[[email protected] ~]#

在 heat 域中创建管理项目和用户的``heat_domain_admin``用户

[[email protected] ~]# openstack user create --domain heat --password-prompt heat_domain_admin

User Password:

Repeat User Password:

+-----------+----------------------------------+

| Field     | Value                            |

+-----------+----------------------------------+

| domain_id | dbb18adb37e74e78bb5165f14efa3a25 |

| enabled   | True                             |

| id        | 6131013190c84113a0316c8f9a0686fa |

| name      | heat_domain_admin                |

+-----------+----------------------------------+

[[email protected] ~]#

授权 heat 域 中的 heat_domain_admin 用户拥有管理员权限

[[email protected] ~]# openstack role add --domain heat --user-domain heat --user heat_domain_admin admin

[[email protected] ~]#

创建 heat_stack_owner 用户

[[email protected] ~]# openstack role create heat_stack_owner

+-----------+----------------------------------+

| Field     | Value                            |

+-----------+----------------------------------+

| domain_id | None                             |

| id        | e38522bfda184a17b1e5cfce7ea61b7e |

| name      | heat_stack_owner                 |

+-----------+----------------------------------+

[[email protected] ~]#

授权 heat_stack_owner 拥有demo域的管理权限

[[email protected] ~]# openstack role add --project demo --user demo heat_stack_owner

[[email protected] ~]#

创建 heat_stack_user 角色

Orchestration 会自动地分配 heat_stack_user 角色给在 stack 部署过程中创建的用户。默认情况下,这个角色会限制 API 的操作。为了避免冲突,请不要为用户添加 ``heat_stack_owner``角色

[[email protected] ~]# openstack role create heat_stack_user

+-----------+----------------------------------+

| Field     | Value                            |

+-----------+----------------------------------+

| domain_id | None                             |

| id        | c4f1be2faa174a189db0d75a65753d91 |

| name      | heat_stack_user                  |

+-----------+----------------------------------+

[[email protected] ~]#

安装及修改配置文件

[[email protected] ~]# yum install -y openstack-heat-api openstack-heat-api-cfn \

>   openstack-heat-engine

[[email protected] ~]# cp /etc/heat/heat.conf{,.bak}

[[email protected] ~]# vim /etc/heat/heat.conf

[[email protected] ~]# grep -v ^# /etc/heat/heat.conf | tr -s [[:space:]]

[DEFAULT]

rpc_backend = rabbit

heat_metadata_server_url = http://controller:8000

heat_waitcondition_server_url = http://controller:8000/v1/waitcondition

stack_domain_admin = heat_domain_admin

stack_domain_admin_password = HEAT_DOMAIN_ADMIN_PASS

stack_user_domain_name = heat

[keystone_authtoken]

auth_uri = http://controller:5000

auth_url = http://controller:35357

memcached_servers = controller:11211

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = heat

password = HEAT_PASS

[auth_password]

[clients]

[clients_barbican]

[clients_ceilometer]

[clients_cinder]

[clients_designate]

[clients_glance]

[clients_heat]

[clients_keystone]

auth_uri = http://controller:35357

[clients_magnum]

[clients_manila]

[clients_mistral]

[clients_neutron]

[clients_nova]

[clients_sahara]

[clients_senlin]

[clients_swift]

[clients_trove]

[clients_zaqar]

[cors]

[cors.subdomain]

[database]

connection = mysql+pymysql://heat:[email protected]/heat

[ec2authtoken]

auth_uri = http://controller:5000/v2.0

[eventlet_opts]

[heat_api]

[heat_api_cfn]

[heat_api_cloudwatch]

[matchmaker_redis]

[oslo_messaging_amqp]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

rabbit_host = controller

rabbit_userid = openstack

rabbit_password = RABBIT_PASS

[oslo_middleware]

[oslo_policy]

[paste_deploy]

[profiler]

[revision]

[ssl]

[trustee]

auth_plugin = password

auth_url = http://controller:35357

username = heat

password = HEAT_PASS

user_domain_name = default

[[email protected] ~]#

导入Orchestration数据库

[[email protected] ~]# su -s /bin/sh -c "heat-manage db_sync" heat

2017-07-28 21:09:59.444 23666 INFO migrate.versioning.api [-] 27 -> 28...

2017-07-28 21:10:01.960 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:01.961 23666 INFO migrate.versioning.api [-] 28 -> 29...

2017-07-28 21:10:02.858 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:02.858 23666 INFO migrate.versioning.api [-] 29 -> 30...

2017-07-28 21:10:02.958 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:02.959 23666 INFO migrate.versioning.api [-] 30 -> 31...

2017-07-28 21:10:03.466 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:03.466 23666 INFO migrate.versioning.api [-] 31 -> 32...

2017-07-28 21:10:04.497 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:04.497 23666 INFO migrate.versioning.api [-] 32 -> 33...

2017-07-28 21:10:05.819 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:05.819 23666 INFO migrate.versioning.api [-] 33 -> 34...

2017-07-28 21:10:06.108 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:06.108 23666 INFO migrate.versioning.api [-] 34 -> 35...

2017-07-28 21:10:08.958 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:08.959 23666 INFO migrate.versioning.api [-] 35 -> 36...

2017-07-28 21:10:09.517 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:09.517 23666 INFO migrate.versioning.api [-] 36 -> 37...

2017-07-28 21:10:09.625 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:09.625 23666 INFO migrate.versioning.api [-] 37 -> 38...

2017-07-28 21:10:10.193 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:10.194 23666 INFO migrate.versioning.api [-] 38 -> 39...

2017-07-28 21:10:10.735 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:10.735 23666 INFO migrate.versioning.api [-] 39 -> 40...

2017-07-28 21:10:11.547 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:11.547 23666 INFO migrate.versioning.api [-] 40 -> 41...

2017-07-28 21:10:11.615 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:11.615 23666 INFO migrate.versioning.api [-] 41 -> 42...

2017-07-28 21:10:12.537 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:12.537 23666 INFO migrate.versioning.api [-] 42 -> 43...

2017-07-28 21:10:12.653 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:12.654 23666 INFO migrate.versioning.api [-] 43 -> 44...

2017-07-28 21:10:13.618 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:13.619 23666 INFO migrate.versioning.api [-] 44 -> 45...

2017-07-28 21:10:14.436 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:14.436 23666 INFO migrate.versioning.api [-] 45 -> 46...

2017-07-28 21:10:15.376 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:15.377 23666 INFO migrate.versioning.api [-] 46 -> 47...

2017-07-28 21:10:16.063 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:16.064 23666 INFO migrate.versioning.api [-] 47 -> 48...

2017-07-28 21:10:16.205 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:16.205 23666 INFO migrate.versioning.api [-] 48 -> 49...

2017-07-28 21:10:17.285 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:17.286 23666 INFO migrate.versioning.api [-] 49 -> 50...

2017-07-28 21:10:17.895 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:17.896 23666 INFO migrate.versioning.api [-] 50 -> 51...

2017-07-28 21:10:18.505 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:18.505 23666 INFO migrate.versioning.api [-] 51 -> 52...

2017-07-28 21:10:19.463 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:19.464 23666 INFO migrate.versioning.api [-] 52 -> 53...

2017-07-28 21:10:20.087 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:20.088 23666 INFO migrate.versioning.api [-] 53 -> 54...

2017-07-28 21:10:21.422 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:21.422 23666 INFO migrate.versioning.api [-] 54 -> 55...

2017-07-28 21:10:25.088 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:25.089 23666 INFO migrate.versioning.api [-] 55 -> 56...

2017-07-28 21:10:27.350 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:27.350 23666 INFO migrate.versioning.api [-] 56 -> 57...

2017-07-28 21:10:32.898 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:32.898 23666 INFO migrate.versioning.api [-] 57 -> 58...

2017-07-28 21:10:34.532 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:34.532 23666 INFO migrate.versioning.api [-] 58 -> 59...

2017-07-28 21:10:35.166 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:35.166 23666 INFO migrate.versioning.api [-] 59 -> 60...

2017-07-28 21:10:40.682 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:40.683 23666 INFO migrate.versioning.api [-] 60 -> 61...

2017-07-28 21:10:44.074 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:44.075 23666 INFO migrate.versioning.api [-] 61 -> 62...

2017-07-28 21:10:44.833 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:44.834 23666 INFO migrate.versioning.api [-] 62 -> 63...

2017-07-28 21:10:45.580 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:45.580 23666 INFO migrate.versioning.api [-] 63 -> 64...

2017-07-28 21:10:46.316 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:46.317 23666 INFO migrate.versioning.api [-] 64 -> 65...

2017-07-28 21:10:47.077 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:47.077 23666 INFO migrate.versioning.api [-] 65 -> 66...

2017-07-28 21:10:47.118 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:47.119 23666 INFO migrate.versioning.api [-] 66 -> 67...

2017-07-28 21:10:47.160 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:47.160 23666 INFO migrate.versioning.api [-] 67 -> 68...

2017-07-28 21:10:47.199 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:47.199 23666 INFO migrate.versioning.api [-] 68 -> 69...

2017-07-28 21:10:47.235 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:47.235 23666 INFO migrate.versioning.api [-] 69 -> 70...

2017-07-28 21:10:47.361 23666 INFO migrate.versioning.api [-] done

2017-07-28 21:10:47.361 23666 INFO migrate.versioning.api [-] 70 -> 71...

2017-07-28 21:10:47.585 23666 INFO migrate.versioning.api [-] done

[[email protected] ~]# mysql -e "show tables from heat"

+---------------------+

| Tables_in_heat      |

+---------------------+

| event               |

| migrate_version     |

| raw_template        |

| resource            |

| resource_data       |

| service             |

| snapshot            |

| software_config     |

| software_deployment |

| stack               |

| stack_lock          |

| stack_tag           |

| sync_point          |

| user_creds          |

| watch_data          |

| watch_rule          |

+---------------------+

[[email protected] ~]#

启用并启动Orchestration服务

[email protected] ~]# 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.

[[email protected] ~]# systemctl start openstack-heat-api.service \

>   openstack-heat-api-cfn.service openstack-heat-engine.service

[[email protected] ~]# ss -tnl  //Orchestration服务正常启动后会新增8000和8004端口

State       Recv-Q Send-Q                             Local Address:Port                                            Peer Address:Port

LISTEN      0      128                                            *:8776                                                       *:*

LISTEN      0      128                                            *:25672                                                      *:*

LISTEN      0      128                                192.168.10.10:3306                                                       *:*

LISTEN      0      128                                    127.0.0.1:11211                                                      *:*

LISTEN      0      128                                            *:9292                                                       *:*

LISTEN      0      128                                            *:4369                                                       *:*

LISTEN      0      128                                            *:8000                                                       *:*

LISTEN      0      128                                            *:9696                                                       *:*

LISTEN      0      100                                            *:6080                                                       *:*

LISTEN      0      128                                            *:8004                                                       *:*

LISTEN      0      128                                            *:8774                                                       *:*

LISTEN      0      128                                            *:22022                                                      *:*

LISTEN      0      128                                            *:8775                                                       *:*

LISTEN      0      128                                            *:9191                                                       *:*

LISTEN      0      128                                           :::5000                                                      :::*

LISTEN      0      128                                           :::5672                                                      :::*

LISTEN      0      128                                          ::1:11211                                                     :::*

LISTEN      0      128                                           :::80                                                        :::*

LISTEN      0      128                                           :::8786                                                      :::*

LISTEN      0      128                                           :::35357                                                     :::*

LISTEN      0      128                                           :::22022                                                     :::*

[[email protected] ~]#

以管理员身份验证服务

[[email protected] ~]# . admin-openrc

[[email protected] ~]# openstack orchestration service list

+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+

| hostname   | binary      | engine_id                            | host       | topic  | updated_at                 | status |

+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+

| controller | heat-engine | 972db5de-71c8-4700-b11b-0f0d4c885d91 | controller | engine | 2017-07-28T13:17:39.000000 | up     |

| controller | heat-engine | 69197de6-096a-4115-a349-b0a54b33d6fe | controller | engine | 2017-07-28T13:17:39.000000 | up     |

| controller | heat-engine | b3223830-c9c9-4b5a-8cb5-8c658130854e | controller | engine | 2017-07-28T13:17:39.000000 | up     |

| controller | heat-engine | 38e6f832-b5c4-42e8-9583-fe3c5768de89 | controller | engine | 2017-07-28T13:17:39.000000 | up     |

| controller | heat-engine | ea4c17ca-24d2-412e-a4f5-2ca1eaf7ba50 | controller | engine | 2017-07-28T13:17:39.000000 | up     |

| controller | heat-engine | 3948deb4-34c2-4536-9e3a-1964bb8668fd | controller | engine | 2017-07-28T13:17:39.000000 | up     |

| controller | heat-engine | 29de671d-50bb-4ee1-8486-a2b6b22dfbeb | controller | engine | 2017-07-28T13:17:39.000000 | up     |

| controller | heat-engine | 2fa7e7dd-70c9-4094-8686-4e727ae19913 | controller | engine | 2017-07-28T13:17:39.000000 | up     |

+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+

[[email protected] ~]#

创建一个模板

[[email protected] ~]# vim demo-template.yml

[[email protected] ~]# cat demo-template.yml

heat_template_version: 2016-04-08

description: Launch a basic instance with CirrOS image using the

``m1.nano`` flavor, ``mykey`` key,  and one network.

parameters:

NetID:

type: string

description: Network ID to use for the instance.

resources:

server:

type: OS::Nova::Server

properties:

image: cirros

flavor: m1.nano

key_name: mykey

networks:

- network: { get_param: NetID }

outputs:

instance_name:

description: Name of the instance.

value: { get_attr: [ server, name ] }

instance_ip:

description: IP address of the instance.

value: { get_attr: [ server, first_address ] }

[[email protected] ~]#

创建一个stack

[[email protected] ~]# . demo-openrc

[[email protected] ~]# openstack network list

+--------------------------------------+-------------+--------------------------------------+

| ID                                   | Name        | Subnets                              |

+--------------------------------------+-------------+--------------------------------------+

| 3b9946b0-b55a-4cdf-a1e4-252a9557fd06 | selfservice | e51d7043-49ff-45ab-a407-6739e0974144 |

| 3bd7b504-e172-462b-a904-c7df815964b3 | provider    | 7e8b9dbb-28a3-406d-b598-4837030cbba4 |

+--------------------------------------+-------------+--------------------------------------+

[[email protected] ~]#

申明模版文件中所需要的变量

[[email protected] ~]# export NET_ID=$(openstack network list | awk ‘/ provider / { print $2 }‘)

使用模版创建并启动一个栈

[[email protected] ~]# openstack stack create -t demo-template.yml --parameter "NetID=$NET_ID" stack

+---------------------+----------------------------------------------------------------------------------------------------------+

| Field               | Value                                                                                                    |

+---------------------+----------------------------------------------------------------------------------------------------------+

| id                  | 32fe747c-5a3b-4e58-9b25-bd56d7cd9eeb                                                                     |

| stack_name          | stack                                                                                                    |

| description         | Launch a basic instance with CirrOS image using the ``m1.nano`` flavor, ``mykey`` key,  and one network. |

| creation_time       | 2017-07-29T02:29:13                                                                                      |

| updated_time        | None                                                                                                     |

| stack_status        | CREATE_IN_PROGRESS                                                                                       |

| stack_status_reason | Stack CREATE started                                                                                     |

+---------------------+----------------------------------------------------------------------------------------------------------+

[[email protected] ~]# openstack stack list

+--------------------------------------+------------+--------------------+---------------------+--------------+

| ID                                   | Stack Name | Stack Status       | Creation Time       | Updated Time |

+--------------------------------------+------------+--------------------+---------------------+--------------+

| 32fe747c-5a3b-4e58-9b25-bd56d7cd9eeb | stack      | CREATE_IN_PROGRESS | 2017-07-29T02:29:13 | None         |

+--------------------------------------+------------+--------------------+---------------------+--------------+

[[email protected] ~]# openstack stack show 32fe747c-5a3b-4e58-9b25-bd56d7cd9eeb

+-----------------------+----------------------------------------------------------------------------------------------------------------------+

| Field                 | Value                                                                                                                |

+-----------------------+----------------------------------------------------------------------------------------------------------------------+

| id                    | 32fe747c-5a3b-4e58-9b25-bd56d7cd9eeb                                                                                 |

| stack_name            | stack                                                                                                                |

| description           | Launch a basic instance with CirrOS image using the ``m1.nano`` flavor, ``mykey`` key,  and one network.             |

| creation_time         | 2017-07-29T02:29:13                                                                                                  |

| updated_time          | None                                                                                                                 |

| stack_status          | CREATE_COMPLETE                                                                                                      |

| stack_status_reason   | Stack CREATE completed successfully                                                                                  |

| parameters            | NetID: 3bd7b504-e172-462b-a904-c7df815964b3                                                                          |

|                       | OS::project_id: 0200f6457da84abd9055a5c192386747                                                                     |

|                       | OS::stack_id: 32fe747c-5a3b-4e58-9b25-bd56d7cd9eeb                                                                   |

|                       | OS::stack_name: stack                                                                                                |

|                       |                                                                                                                      |

| outputs               | - description: Name of the instance.                                                                                 |

|                       |   output_key: instance_name                                                                                          |

|                       |   output_value: stack-server-byn23ksv35os                                                                            |

|                       | - description: IP address of the instance.                                                                           |

|                       |   output_key: instance_ip                                                                                            |

|                       |   output_value: 10.0.0.105                                                                                           |

|                       |                                                                                                                      |

| links                 | - href: http://controller:8004/v1/0200f6457da84abd9055a5c192386747/stacks/stack/32fe747c-5a3b-4e58-9b25-bd56d7cd9eeb |

|                       |   rel: self                                                                                                          |

|                       |                                                                                                                      |

| disable_rollback      | True                                                                                                                 |

| parent                | None                                                                                                                 |

| tags                  | null                                                                                                                 |

|                       | ...                                                                                                                  |

|                       |                                                                                                                      |

| stack_user_project_id | 4677bcbb8f88481494a72a264e7f4727                                                                                     |

| capabilities          | []                                                                                                                   |

| notification_topics   | []                                                                                                                   |

| timeout_mins          | None                                                                                                                 |

| stack_owner           | None                                                                                                                 |

+-----------------------+----------------------------------------------------------------------------------------------------------------------+

[[email protected] ~]# openstack stack output show --all stack

+---------------+-------------------------------------------------+

| Field         | Value                                           |

+---------------+-------------------------------------------------+

| instance_name | {                                               |

|               |   "output_value": "stack-server-byn23ksv35os",  |

|               |   "output_key": "instance_name",                |

|               |   "description": "Name of the instance."        |

|               | }                                               |

| instance_ip   | {                                               |

|               |   "output_value": "10.0.0.105",                 |

|               |   "output_key": "instance_ip",                  |

|               |   "description": "IP address of the instance."  |

|               | }                                               |

+---------------+-------------------------------------------------+

[[email protected] ~]# openstack server list  //实例创建后会自动启动

+--------------------------------------+---------------------------+---------+------------------------------------+

| ID                                   | Name                      | Status  | Networks                           |

+--------------------------------------+---------------------------+---------+------------------------------------+

| 1f0b1032-1fec-4333-b567-76c8a2434e73 | stack-server-byn23ksv35os | ACTIVE  | provider=10.0.0.105                |

| a7c51098-20d7-4f01-b3b9-451694fddfb4 | selfservice-instance      | SHUTOFF | selfservice=172.16.0.3, 10.0.0.104 |

| a8234b31-7acb-4f2c-abfc-34d8bfd76438 | provider-instance         | SHUTOFF | provider=10.0.0.102                |

+--------------------------------------+---------------------------+---------+------------------------------------+

[[email protected] ~]# openstack server show 1f0b1032-1fec-4333-b567-76c8a2434e73

+--------------------------------------+----------------------------------------------------------+

| Field                                | Value                                                    |

+--------------------------------------+----------------------------------------------------------+

| OS-DCF:diskConfig                    | MANUAL                                                   |

| OS-EXT-AZ:availability_zone          | nova                                                     |

| OS-EXT-STS:power_state               | 1                                                        |

| OS-EXT-STS:task_state                | None                                                     |

| OS-EXT-STS:vm_state                  | active                                                   |

| OS-SRV-USG:launched_at               | 2017-07-29T02:29:36.000000                               |

| OS-SRV-USG:terminated_at             | None                                                     |

| accessIPv4                           |                                                          |

| accessIPv6                           |                                                          |

| addresses                            | provider=10.0.0.105                                      |

| config_drive                         |                                                          |

| created                              | 2017-07-29T02:29:25Z                                     |

| flavor                               | m1.nano (0)                                              |

| hostId                               | a33066b316f8685eaf842bff56b5d4806daae5ef486f84a9904f7e82 |

| id                                   | 1f0b1032-1fec-4333-b567-76c8a2434e73                     |

| image                                | cirros (9b0a7de0-6ff5-488b-9067-813e8a88de98)            |

| key_name                             | mykey                                                    |

| name                                 | stack-server-byn23ksv35os                                |

| os-extended-volumes:volumes_attached | []                                                       |

| progress                             | 0                                                        |

| project_id                           | 0200f6457da84abd9055a5c192386747                         |

| properties                           |                                                          |

| security_groups                      | [{u‘name‘: u‘default‘}]                                  |

| status                               | ACTIVE                                                   |

| updated                              | 2017-07-29T02:29:37Z                                     |

| user_id                              | deb3adea97e34fee9161a47940762a53                         |

+--------------------------------------+----------------------------------------------------------+

[[email protected] ~]# openstack stack delete --yes stack  //删除stack

    至此,已经使用了heat模版语言定义了一下简单的模版,并通过此模版成功启动一个实例,更多模版语法请自行参阅openstack官方提供的说明。

时间: 2024-08-05 07:03:52

openstack安装配置—— orchestration安装配置的相关文章

Oracle VM + centos7.1+openstack kilo 多结点安装教程---基础环境配置(4)

声明:最近在进行openstack的kilo版本的安装,发现现有的网络教程非常少,而且多数教程并不能安装成功,故写此教程.openstack的安装较为复杂,本教程并不能保证在不同环境下也能将其安装成功.个人安装教程,也难免出错.同时,安装是在虚拟机环境下,真实安装环境需要进行更改. 转载请声明出处: 作者:张某人ER 原文链接:http://blog.csdn.net/xinxing__8185/article/details/51103863 第一部分 基础环境配置 (4) 接下来 配置com

Centos6.4配置总结--安装篇(Ⅰ)

下图是我从官网下载的CentOS-6.4-i386-bin-DVD,有两张光盘,第一张是系统盘,第二张是附属的一些软件.该系统我将要安装到VMware虚拟机上,我的本机是win8 在VMware上新建一台虚拟机,分配内存的时候注意一下,你分配的内存大小会决定你的Linux会以什么的模式安装. 该版本的Linux安装模式有两种,即文本模式和图形模式.文本模式安装的时候会没有自定义分区大小的功能,图形模式有.据说分配的计算机内存必须等于或者大于628M才会启动图形安装模式,我当时分配512M内存的时

PDI 学习2:KETTLE安装,环境变量配置,开发准备

在这里把环境变量的配置具体拿出来,有问题的同学自己比对一下: 1.安装JDK,KETTLE 1) KETTLE拷贝程序包,绿色安装: 官方下载:http://community.pentaho.com/projects/data-integration/ 2) JDK安装: 2.配置系统环境变量 ( 已有的变量,在后面新增值:没有的变量新增变量和值) 1) JDK ( 参考如下,按实际情况配置) 关注JAVA_HOME  和 PATH 变量 值 JAVA_HOME D:\Program File

JDK安装与环境变量配置方法--Java环境

第一步:下载JDK,可直接双击安装,到如下图这一步可以点击[更改],将JDK安装到自己指定的路径. 注:若无安装目录要求,可全默认设置.无需做任何修改,两次均直接点下一步即可. 第二步:安装完JDK后配置环境变量  计算机→属性→高级系统设置→高级→环境变量 第三步: DOS的批处理命令直接运行: 创建auto.bat文件,在其末尾加入: set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121 set PATH=%JAVA_HOME%\bin;C:\Pr

jdk(Java SE JDK)安装与环境变量配置攻略

2017-01-08 21:00:55  jdk安装与环境变量配置攻略   1.下载jdk安装包 附个下载链接 http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.安装JDK 选择安装目录,其中安装过程中会出现两次提示 .First.安装 jdk ,Second.安装 jre .小编建议两个安装在同一文件夹的不同子文件夹中. (jdk和jre不能安装在同一文件夹的根目录下,jdk和jre安装在同一文件夹极易出错

Ubuntu下安装JDK以及相关配置

1.查看系统位数,输入以下命令即可 getconf LONG_BIT 2.下载对应的JDK文件,我这里下载的是jdk-8u60-linux-64.tar.gz 3.创建目录作为JDK的安装目录,这里选择安装位置为:/usr/java/ sudo mkdir /usr/java 4.解压文件带/usr/java/目录下,文件下载的位置是在下载目录下的 cd 下载sudo tar zxvf jdk-8u60-linux-x64.tar.gz -C /usr/java/ 5.进入到/usr/java/

ubuntu编译安装postgresql及主从配置

操作系统版本    Ubuntu 14.04 数据库软件版本     postgresql-9.4.7.tar.gz 安装方式    编译安装 软件安装目录    /usr/local/pgsql 数据存放目录    /service/postgresql/data 日志存放目录    /service/postgresql/archive 1.安装依赖包 sudo apt-get update sudo apt-get install  libreadline6-dev sudo apt-ge

debain(SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux)安装注意点及配置

1. 无线网卡驱动准备 安装时准备好驱动(我的Dell6430配置intel u系列)(下载驱动并解压放在可识别存储设备上) 2-18来自“千里之行始于足下” 2. 安装和配置 sudo 切换到root用户 apt-get install sudo 配置 /etc/sudoers,使你的帐户具有sudo权限 root ALL=(ALL:ALL) ALL wangyubin ALL=(ALL:ALL) ALL # 添加需要的用户 3. 设置 sudo 不用密码 # User privilege s

在MyEclipse配置自己安装的Tomcat(2014.08.18)

今天因为要在tomcat下运行一个java项目,第一次嘛,遇到了不少问题,总结分享一下: 第一次,我直接将 MyEclipse 生成的项目放到 tomcat 安装目录的 webapps 目录下,运行出现404,无法访问. 然后想了想,发现这是个错误的做法.应该先通过 MyEclipse 将项目部署到 Tomcat 下: 然后, MyEclipse 自带了 tomcat,我要配置自己安装的 TomCat : (请看参考资料:http://jingyan.baidu.com/article/4853