Showing posts with label YAML. Show all posts
Showing posts with label YAML. Show all posts

Thursday, October 19, 2017

OpenStack Orchestration Heat Stack to create a network OpenStack Newton

OpenStack Orchestration Heat Stack to create a network OpenStack Newton 



The YAML file for the same as example is as 


[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]# cat 04net.yml
---
# for Newton release of OpenStack
#
heat_template_version: 2016-10-14

description: having a private network in place

resources:
  private_net:
    type: OS::Neutron::Net
    properties:
      name: internal1
      shared: true

outputs:
  net_info:
    value: { get_attr: [private_net]}
[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#


Creation of a stack using the definition above creates a network with the name as "internal".

Running the stack 


openstack stack create -t 04net.yml internal1_network 

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| id                  | 95f4779a-ac2e-4d41-aec3-5236d24d0bb3 |
| stack_name          | internal1_network                    |
| description         | having a private network in place    |
| creation_time       | 2017-10-19T20:52:01Z                 |
| updated_time        | None                                 |
| stack_status        | CREATE_IN_PROGRESS                   |
| stack_status_reason | Stack CREATE started                 |
+---------------------+--------------------------------------+
--------

See the stack information 


openstack stack show internal1_network

+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Field                 | Value                                                                                                                                |
+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| id                    | 95f4779a-ac2e-4d41-aec3-5236d24d0bb3                                                                                                 |
| stack_name            | internal1_network                                                                                                                    |
| description           | having a private network in place                                                                                                    |
| creation_time         | 2017-10-19T20:52:01Z                                                                                                                 |
| updated_time          | None                                                                                                                                 |
| stack_status          | CREATE_COMPLETE                                                                                                                      |
| stack_status_reason   | Stack CREATE completed successfully                                                                                                  |
| parameters            | OS::project_id: 49b25ce4022c492fa0c1eab4fc6c7419                                                                                     |
|                       | OS::stack_id: 95f4779a-ac2e-4d41-aec3-5236d24d0bb3                                                                                   |
|                       | OS::stack_name: internal1_network                                                                                                    |
|                       |                                                                                                                                      |
| outputs               | - description: No description given                                                                                                  |
|                       |   output_error: '''qos_policy_id'''                                                                                                  |
|                       |   output_key: net_info                                                                                                               |
|                       |   output_value: null                                                                                                                 |
|                       |                                                                                                                                      |
| links                 | - href: http://172.29.240.100:8004/v1/49b25ce4022c492fa0c1eab4fc6c7419/stacks/internal1_network/95f4779a-ac2e-4d41-aec3-5236d24d0bb3 |
|                       |   rel: self                                                                                                                          |
|                       |                                                                                                                                      |
| parent                | None                                                                                                                                 |
| disable_rollback      | True                                                                                                                                 |
| deletion_time         | None                                                                                                                                 |
| stack_user_project_id | d409212bfdd14e50beabc71a01dc7627                                                                                                     |
| capabilities          | []                                                                                                                                   |
| notification_topics   | []                                                                                                                                   |
| stack_owner           | None                                                                                                                                 |
| timeout_mins          | None                                                                                                                                 |
| tags                  | null                                                                                                                                 |
|                       | ...                                                                                                                                  |
|                       |                                                                                                                                      |
+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------+


Confirm that the netwrok has been created

openstack network list

So a network has been created, but there are no subnet yet on the network internal1


[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]# openstack network list
+--------------------------------------+-----------+--------------------------------------+
| ID                                   | Name      | Subnets                              |
+--------------------------------------+-----------+--------------------------------------+
| 0b26c960-6158-4b20-9156-9d163ceaf2f3 | internal0 | 7206c8e9-64ca-4ba1-abef-12639820fd37 |
| 216e5f0c-e0ed-4c04-b912-37c6967a0038 | internal1 |                                      |
| 3bc5a907-42ad-4fa7-aa53-1e514b42d6df | public0   | d8e83610-7b77-4683-abc5-0cf3b6186395 |
+--------------------------------------+-----------+--------------------------------------+



[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#

Using OpenStack Orchestration heat stack to have the custom flavor in place OpenStack Newton

Using OpenStack Orchestration heat stack to have the custom flavor in place


The stack YAML file here helps to create a custom flavor 


[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]# cat 12NovaFlavor.yml
---
# for Newton release of OpenStack
#
heat_template_version: 2016-10-14

description: Nova Flavor

resources:
  NovaFlavor1:
    type: OS::Nova::Flavor
    properties:
      is_public: true
      name: novaflavor1
      disk: 10
      ram: 4096
      swap: 1
      vcpus: 1
outputs:
  NovaFlavor_info:
    value: { get_attr: [NovaFlavor1]}
[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#


This stack as run will create the flavor of the name as 'novaflavor1' having the specifications of the flavor as 

  • disk size: 10GB
  • RAM size: 4GB
  • Swap size: 1GB 
  • Virt CPU count: 1


---

Run the stack



[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#
[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]# openstack stack create -t 12NovaFlavor.yml novaflavor1
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| id                  | cb21ee12-dbee-49a3-8957-3a8ea444c320 |
| stack_name          | novaflavor1                          |
| description         | Nova Flavor                          |
| creation_time       | 2017-10-19T21:54:51Z                 |
| updated_time        | None                                 |
| stack_status        | CREATE_IN_PROGRESS                   |
| stack_status_reason | Stack CREATE started                 |
+---------------------+--------------------------------------+
[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#


The above shows the heat stack is in implementation 

Confirming the creation of the nova flavor



[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]# openstack flavor list
+--------------------------------------+-------------+-------+------+-----------+-------+-----------+
| ID                                   | Name        |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+-------------+-------+------+-----------+-------+-----------+
| 1                                    | m1.tiny     |   512 |    1 |         0 |     1 | True      |
| 1e77331d-56d1-4849-a260-dafc4b88cb76 | novaflavor1 |  4096 |   10 |         0 |     1 | True      |
| 2                                    | m1.small    |  2048 |   20 |         0 |     1 | True      |
| 3                                    | m1.medium   |  4096 |   40 |         0 |     2 | True      |
| 4                                    | m1.large    |  8192 |   80 |         0 |     4 | True      |
| 5                                    | m1.xlarge   | 16384 |  160 |         0 |     8 | True      |
+--------------------------------------+-------------+-------+------+-----------+-------+-----------+
[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#