Showing posts with label Stack. Show all posts
Showing posts with label Stack. Show all posts

Thursday, October 19, 2017

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)]#

Monday, October 9, 2017

Initial things with the OpenStack Heat Orchestration

Initial things with the OpenStack Heat Orchestration



This assumes that the heat orchestration is installed and up and running on the OpenStack setup.


Ensure that the heat openstack services are up and running 


[root@controllero HeatOrchestrationTemplates(keystone_admin)]# openstack-service status | grep -i heat
MainPID=10107 Id=openstack-heat-api-cfn.service ActiveState=active
MainPID=9979 Id=openstack-heat-api.service ActiveState=active
MainPID=10040 Id=openstack-heat-engine.service ActiveState=active
[root@controllero HeatOrchestrationTemplates(keystone_admin)]#


The heat services are listed as in the openstack service list 


[root@controllero HeatOrchestrationTemplates(keystone_admin)]# openstack service list | grep -i heat
| 0de6cc86e884484d9c3a3d8ad21ca3cd | heat-cfn   | cloudformation |
| ce6620cdc68a4d0eb55c114496fbfe39 | heat       | orchestration  |
[root@controllero HeatOrchestrationTemplates(keystone_admin)]#



Ensure that the heat endpoints are available 

[root@controllero HeatOrchestrationTemplates(keystone_admin)]# openstack endpoint list | grep -i heat
| 0a9750e5702f45f0918a2f0e30c3e7c9 | RegionOne | heat-cfn     | cloudformation | True    | public    | http://11.11.1.158:8000/v1                 |
| 1538c41f21b4457c8f70a7c713d133fd | RegionOne | heat         | orchestration  | True    | internal  | http://11.11.1.158:8004/v1/%(tenant_id)s   |
| 50fae48042eb4670bed2528c1ba92346 | RegionOne | heat-cfn     | cloudformation | True    | admin     | http://11.11.1.158:8000/v1                 |
| 542a7341f9fa483288a1e0ff663e49c8 | RegionOne | heat         | orchestration  | True    | admin     | http://11.11.1.158:8004/v1/%(tenant_id)s   |
| 718d545742f349db83aedde62306220b | RegionOne | heat         | orchestration  | True    | public    | http://11.11.1.158:8004/v1/%(tenant_id)s   |
| ab9e670036c74e4fa477ed3ed1e70436 | RegionOne | heat-cfn     | cloudformation | True    | internal  | http://11.11.1.158:8000/v1                 |
[root@controllero HeatOrchestrationTemplates(keystone_admin)]#


It is important to note the Tenant ID in the heat endpoint URL.

Also ensure that the heat services are up and running 


[root@controllero HeatOrchestrationTemplates(keystone_admin)]# heat service-list
WARNING (shell) "heat service-list" is deprecated, please use "openstack orchestration service list" instead
+----------------------------+-------------+--------------------------------------+----------------------------+--------+----------------------------+--------+
| hostname                   | binary      | engine_id                            | host                       | topic  | updated_at                 | status |
+----------------------------+-------------+--------------------------------------+----------------------------+--------+----------------------------+--------+
| controllero.netx.sujit.com | heat-engine | 86f052f1-8aef-4f28-a881-abea2b5fbc51 | controllero.netx.sujit.com | engine | 2017-10-09T08:36:36.000000 | up     |
| controllero.netx.sujit.com | heat-engine | a6ccfe68-50d9-4910-b09a-204b54fd971e | controllero.netx.sujit.com | engine | 2017-10-09T08:36:36.000000 | up     |
| controllero.netx.sujit.com | heat-engine | b90e8883-81af-4180-b56d-25db2229848c | controllero.netx.sujit.com | engine | 2017-10-09T08:36:35.000000 | up     |
| controllero.netx.sujit.com | heat-engine | cdc1bd91-e114-4aec-be23-35421ec83b92 | controllero.netx.sujit.com | engine | 2017-10-09T08:36:36.000000 | up     |
+----------------------------+-------------+--------------------------------------+----------------------------+--------+----------------------------+--------+

[root@controllero HeatOrchestrationTemplates(keystone_admin)]#




  • To list resource types that can be used with the Orchestration heat stack.
  • To write the orchestration templates in YAML format, it is needed to know which are the resource types supported by the given version of the Heat Orchestration of OpenStack and how would the YAML syntax for the same would look like.


So the steps are 

1) get all the orchestration type resources supported by the heat orchestration 
2) get information about a particular resource type to know the YAML format that will go in the template for the same resource.



[root@controllero HeatOrchestrationTemplates(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::ElasticLoadBalancing::LoadBalancer      |
| AWS::IAM::AccessKey                          |
| AWS::IAM::User                               |
| AWS::RDS::DBInstance                         |
| OS::Aodh::Alarm                              |
| OS::Aodh::CombinationAlarm                   |
| OS::Aodh::CompositeAlarm                     |
| OS::Aodh::EventAlarm                         |
| OS::Aodh::GnocchiAggregationByMetricsAlarm   |
| OS::Aodh::GnocchiAggregationByResourcesAlarm |
| OS::Aodh::GnocchiResourcesAlarm              |
| OS::Glance::Image                            |
| OS::Heat::AccessPolicy                       |
| OS::Heat::AutoScalingGroup                   |
| OS::Heat::CloudConfig                        |
| OS::Heat::DeployedServer                     |
| OS::Heat::HARestarter                        |
| 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::LBaaS::HealthMonitor            |
| OS::Neutron::LBaaS::L7Policy                 |
| OS::Neutron::LBaaS::L7Rule                   |
| OS::Neutron::LBaaS::Listener                 |
| OS::Neutron::LBaaS::LoadBalancer             |
| OS::Neutron::LBaaS::Pool                     |
| OS::Neutron::LBaaS::PoolMember               |
| OS::Neutron::MeteringLabel                   |
| OS::Neutron::MeteringRule                    |
| OS::Neutron::Net                             |
| OS::Neutron::NetworkGateway                  |
| OS::Neutron::Port                            |
| OS::Neutron::PortPair                        |
| OS::Neutron::ProviderNet                     |
| 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::Nova::Flavor                             |
| OS::Nova::FloatingIP                         |
| OS::Nova::FloatingIPAssociation              |
| OS::Nova::HostAggregate                      |
| OS::Nova::KeyPair                            |
| OS::Nova::Quota                              |
| OS::Nova::Server                             |
| OS::Nova::ServerGroup                        |
+----------------------------------------------+
[root@controllero HeatOrchestrationTemplates(keystone_admin)]#




# to see the YAML format specification for any resource as a reference you can use 

openstack orchestration resource type show <Heat Resource Stack Name>

# for example if I need to know the syntax for writing the template for the OS::Neutron::Router type resource 

openstack orchestration resource type show OS::Neutron::Router

[root@controllero HeatOrchestrationTemplates(keystone_admin)]# openstack orchestration resource type show OS::Neutron::Router
support_status:
  message: null
  previous_status: null
  status: SUPPORTED
  version: null
attributes:
  admin_state_up:
    description: Administrative state of the router.
    type: string
  external_gateway_info:
    description: Gateway network for the router.
    type: map
  name:
    description: Friendly name of the router.
    type: string
  show:
    description: Detailed information about resource.
    type: map
  status:
    description: The status of the router.
    type: string
  tenant_id:
    description: Tenant owning the router.
    type: string
properties:
  admin_state_up:
    default: true
    description: The administrative state of the router.
    immutable: false
    required: false
    type: boolean
    update_allowed: true
  distributed:
    description: 'Indicates whether or not to create a distributed router. NOTE: The
      default policy setting in Neutron restricts usage of this property to administrative
      users only. This property can not be used in conjunction with the L3 agent ID.'
    immutable: false
    required: false
    type: boolean
    update_allowed: false
  external_gateway_info:
    description: External network gateway configuration for a router.
    immutable: false
    required: false
    schema:
      enable_snat:
        description: 'Enables Source NAT on the router gateway. NOTE: The default
          policy setting in Neutron restricts usage of this property to administrative
          users only.'
        immutable: false
        required: false
        type: boolean
        update_allowed: true
      external_fixed_ips:
        description: External fixed IP addresses for the gateway.
        immutable: false
        required: false
        schema:
          '*':
            immutable: false
            required: false
            schema:
              ip_address:
                constraints:
                - custom_constraint: ip_addr
                description: External fixed IP address.
                immutable: false
                required: false
                type: string
                update_allowed: false
              subnet:
                constraints:
                - custom_constraint: neutron.subnet
                description: Subnet of external fixed IP address.
                immutable: false
                required: false
                type: string
                update_allowed: false
            type: map
            update_allowed: false
        type: list
        update_allowed: true
      network:
        description: ID or name of the external network for the gateway.
        immutable: false
        required: true
        type: string
        update_allowed: true
    type: map
    update_allowed: true
  ha:
    description: 'Indicates whether or not to create a highly available router. NOTE:
      The default policy setting in Neutron restricts usage of this property to administrative
      users only. And now neutron do not support distributed and ha at the same time.'
    immutable: false
    required: false
    type: boolean
    update_allowed: false
  l3_agent_ids:
    description: 'ID list of the L3 agent. User can specify multi-agents for highly
      available router. NOTE: The default policy setting in Neutron restricts usage
      of this property to administrative users only.'
    immutable: false
    required: false
    schema:
      '*':
        immutable: false
        required: false
        type: string
        update_allowed: false
    type: list
    update_allowed: true
  name:
    description: The name of the router.
    immutable: false
    required: false
    type: string
    update_allowed: true
  value_specs:
    default: {}
    description: Extra parameters to include in the creation request.
    immutable: false
    required: false
    type: map
    update_allowed: true

    
    
    
# Hence if there is a need to write an orchestration template to create the Router, you can see how the YAML file has to be and what parameters you choose in the YAML file to write a template for a resource type

Monday, December 12, 2016

Deploying an very basic instance on OpenStack Mitaka using a simple heat orchestration template and associate a Floating IP to the simple stack

Deploying an very basic instance on OpenStack using a simple heat template


The below is a simple sample template which we will use
=========================================================
heat_template_version: 2013-05-23

description: Simple template to deploy a single compute instance

parameters:
  image:
    type: string
    label: Image name or ID
    description: Image to be used for compute instance
    default: cirros-0.3.3-x86_64
  flavor:
    type: string
    label: Flavor
    description: Type of instance (flavor) to be used
    default: m1.small
  key:
    type: string
    label: Key name
    description: Name of key-pair to be used for compute instance
    default: my_key
  private_network:
    type: string
    label: Private network name or ID
    description: Network to attach instance to.
    default: private-net

resources:
  my_instance:
    type: OS::Nova::Server
    properties:
      image: { get_param: image }
      flavor: { get_param: flavor }
      key_name: { get_param: key }
      networks:
        - network: { get_param: private_network }
      user_data: |
        #!/bin/sh
        echo "Hello, World!"
      user_data_format: RAW

outputs:
  instance_name:
    description: Name of the instance
    value: { get_attr: [my_instance, name] }
  instance_ip:
    description: IP address of the instance
    value: { get_attr: [my_instance, first_address] }



The above file has to be copied in the form of an YAML file


We will Need to specify the above in the heat template YAML file: network, instance, flavor, security keys also the instance name

Lets get the information on the resources from the existing OpenStack Setup


Source the required credentials


[root@controller ~]# . keystonerc_admin

See the available flavors
==========================
[root@controller ~(keystone_admin)]# openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 1  | m1.tiny   |   512 |    1 |         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      |
+----+-----------+-------+------+-----------+-------+-----------+


See the available images
========================
[root@controller ~(keystone_admin)]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 44bb15d9-a970-40c4-8b77-a7e71b170659 | Cirros | active |
+--------------------------------------+--------+--------+
[root@controller ~(keystone_admin)]#


See the available networks in neutron
=====================================
[root@controller ~(keystone_admin)]# neutron net-list
+--------------------------------------+-----------+-------------------------------------------------------+
| id                                   | name      | subnets                                               |
+--------------------------------------+-----------+-------------------------------------------------------+
| 60ca0e7b-3c40-482c-92d1-3b4da4126e9d | testnet1  | 8fd08288-a83b-44ee-ac04-f8b88fc69628 172.16.15.0/24   |
| 8649a5a8-c137-444d-950d-e0c0569e3ee4 | internal1 | bd5b5a96-eaf5-45a8-93e5-6be837e61414 172.16.16.0/24   |
| 001ac29b-1f5f-4498-a44b-de0f809d2322 | external  | cf1da694-4a75-4768-b758-859dc750a02d 192.168.205.0/24 |
+--------------------------------------+-----------+-------------------------------------------------------+


See the available subnets in the neutron
========================================
[root@controller ~(keystone_admin)]# neutron subnet-list
+--------------------------------------+--------------+------------------+--------------------------------------------------------+
| id                                   | name         | cidr             | allocation_pools                                       |
+--------------------------------------+--------------+------------------+--------------------------------------------------------+
| 8fd08288-a83b-44ee-ac04-f8b88fc69628 | testsub      | 172.16.15.0/24   | {"start": "172.16.15.2", "end": "172.16.15.254"}       |
| bd5b5a96-eaf5-45a8-93e5-6be837e61414 | internal1sub | 172.16.16.0/24   | {"start": "172.16.16.2", "end": "172.16.16.254"}       |
| cf1da694-4a75-4768-b758-859dc750a02d | extsub       | 192.168.205.0/24 | {"start": "192.168.205.101", "end": "192.168.205.254"} |
+--------------------------------------+--------------+------------------+--------------------------------------------------------+

See the available keypairs for the project
==========================================
[root@controller ~(keystone_admin)]# openstack keypair list
+------+-------------------------------------------------+
| Name | Fingerprint                                     |
+------+-------------------------------------------------+
| key1 | 2f:40:44:36:1d:b9:ab:cd:b6:57:24:c7:70:dc:8c:f7 |
+------+-------------------------------------------------+
[root@controller ~(keystone_admin)]#


Lets edit the YAML file which will look like below now

heat_template_version: 2013-05-23

description: Simple template to deploy a single compute instance

parameters:
  image:
    type: string
    label: Image name or ID
    description: Image to be used for compute instance
    default: Cirros
  flavor:
    type: string
    label: Flavor
    description: Type of instance (flavor) to be used
    default: m1.tiny
  key:
    type: string
    label: Key name
    description: Name of key-pair to be used for compute instance
    default: key1
  private_network:
    type: string
    label: Private network name or ID
    description: Network to attach instance to.
    default: internal1

resources:
  my_instance:
    type: OS::Nova::Server
    properties:
      image: { get_param: image }
      flavor: { get_param: flavor }
      key_name: { get_param: key }
      networks:
        - network: { get_param: private_network }
      user_data: |
        #!/bin/sh
        echo "Hello, World!"
      user_data_format: RAW

outputs:
  instance_name:
    description: Name of the instance
    value: { get_attr: [my_instance, name] }
  instance_ip:
    description: IP address of the instance
    value: { get_attr: [my_instance, first_address] }




Lets copy this YAML file in the OpenStack server as the file heatstack1.yaml


Create the stack syntax:

heat stack-create <Name of the Stack> -f <file containing YAML information of the stack>

heat stack-create stack1 -f heatstack1.yaml


Create the stack using the YAML file
====================================

[root@controller ~(keystone_admin)]# heat stack-create stack1 -f heatstack1.yaml
+--------------------------------------+------------+--------------------+---------------------+--------------+
| id                                   | stack_name | stack_status       | creation_time       | updated_time |
+--------------------------------------+------------+--------------------+---------------------+--------------+
| 5ab8fe95-7ea3-4530-86de-facae9f52c71 | stack1     | CREATE_IN_PROGRESS | 2016-12-07T06:31:07 | None         |
+--------------------------------------+------------+--------------------+---------------------+--------------+
[root@controller ~(keystone_admin)]#


See the list of the stacks
==========================
[root@controller ~(keystone_admin)]# heat stack-list
+--------------------------------------+------------+-----------------+---------------------+--------------+
| id                                   | stack_name | stack_status    | creation_time       | updated_time |
+--------------------------------------+------------+-----------------+---------------------+--------------+
| 5ab8fe95-7ea3-4530-86de-facae9f52c71 | stack1     | CREATE_COMPLETE | 2016-12-07T06:31:07 | None         |
+--------------------------------------+------------+-----------------+---------------------+--------------+
[root@controller ~(keystone_admin)]#
[root@controller ~(keystone_admin)]#


See more information on the Stack which is created
===================================================
[root@controller ~(keystone_admin)]# heat stack-show stack1
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------+
| Property              | Value                                                                                                                            |
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------+
| capabilities          | []                                                                                                                               |
| creation_time         | 2016-12-07T06:31:07                                                                                                              |
| description           | Simple template to deploy a single compute instance                                                                              |
| disable_rollback      | True                                                                                                                             |
| id                    | 5ab8fe95-7ea3-4530-86de-facae9f52c71                                                                                             |
| links                 | http://controller.example.com:8004/v1/f84cfac47c10472fb36c56dc149d3caa/stacks/stack1/5ab8fe95-7ea3-4530-86de-facae9f52c71 (self) |
| notification_topics   | []                                                                                                                               |
| outputs               | [                                                                                                                                |
|                       |   {                                                                                                                              |
|                       |     "output_value": "stack1-my_instance-rrmsgn57cvxy",                                                                           |
|                       |     "output_key": "instance_name",                                                                                               |
|                       |     "description": "Name of the instance"                                                                                        |
|                       |   },                                                                                                                             |
|                       |   {                                                                                                                              |
|                       |     "output_value": "172.16.16.5",                                                                                               |
|                       |     "output_key": "instance_ip",                                                                                                 |
|                       |     "description": "IP address of the instance"                                                                                  |
|                       |   }                                                                                                                              |
|                       | ]                                                                                                                                |
| parameters            | {                                                                                                                                |
|                       |   "OS::project_id": "f84cfac47c10472fb36c56dc149d3caa",                                                                          |
|                       |   "OS::stack_id": "5ab8fe95-7ea3-4530-86de-facae9f52c71",                                                                        |
|                       |   "OS::stack_name": "stack1",                                                                                                    |
|                       |   "image": "Cirros",                                                                                                             |
|                       |   "key": "key1",                                                                                                                 |
|                       |   "private_network": "internal1",                                                                                                |
|                       |   "flavor": "m1.tiny"                                                                                                            |
|                       | }                                                                                                                                |
| parent                | None                                                                                                                             |
| stack_name            | stack1                                                                                                                           |
| stack_owner           | None                                                                                                                             |
| stack_status          | CREATE_COMPLETE                                                                                                                  |
| stack_status_reason   | Stack CREATE completed successfully                                                                                              |
| stack_user_project_id | f7e5c9e4b80f4f1faf411c95880c1309                                                                                                 |
| tags                  | null                                                                                                                             |
| template_description  | Simple template to deploy a single compute instance                                                                              |
| timeout_mins          | None                                                                                                                             |
| updated_time          | None                                                                                                                             |
+-----------------------+----------------------------------------------------------------------------------------------------------------------------------+
[root@controller ~(keystone_admin)]#


Association of the floating IP to the instance
================================================
Asscoiate a floating IP to the instance. Create a floating IP if there are no free floating IPs available.

Get the information on all the networks, here the external is the external network in which the floating IP will get created.

[root@controller ~(keystone_admin)]# neutron net-list
+--------------------------------------+-----------+-------------------------------------------------------+
| id                                   | name      | subnets                                               |
+--------------------------------------+-----------+-------------------------------------------------------+
| 60ca0e7b-3c40-482c-92d1-3b4da4126e9d | testnet1  | 8fd08288-a83b-44ee-ac04-f8b88fc69628 172.16.15.0/24   |
| 8649a5a8-c137-444d-950d-e0c0569e3ee4 | internal1 | bd5b5a96-eaf5-45a8-93e5-6be837e61414 172.16.16.0/24   |
| 001ac29b-1f5f-4498-a44b-de0f809d2322 | external  | cf1da694-4a75-4768-b758-859dc750a02d 192.168.205.0/24 |
+--------------------------------------+-----------+-------------------------------------------------------+
[root@controller ~(keystone_admin)]# neutron floatingip-create externla^C
[root@controller ~(keystone_admin)]#


Create a floating IP in the external network
=============================================

[root@controller ~(keystone_admin)]# neutron floatingip-create external
Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| description         |                                      |
| fixed_ip_address    |                                      |
| floating_ip_address | 192.168.205.105                      |
| floating_network_id | 001ac29b-1f5f-4498-a44b-de0f809d2322 |
| id                  | ab40dcbd-1082-424a-b0fb-135b8756bc91 |
| port_id             |                                      |
| router_id           |                                      |
| status              | DOWN                                 |
| tenant_id           | f84cfac47c10472fb36c56dc149d3caa     |
+---------------------+--------------------------------------+
[root@controller ~(keystone_admin)]#


Ensure the floating IP is listed and that the UUID of floating IP appears as free floating IP
===============================================================

[root@controller ~(keystone_admin)]# neutron floatingip-list
+--------------------------------------+------------------+---------------------+--------------------------------------+
| id                                   | fixed_ip_address | floating_ip_address | port_id                              |
+--------------------------------------+------------------+---------------------+--------------------------------------+
| 816e8bf9-7dec-4011-9333-f761b8b95c15 | 172.16.15.3      | 192.168.205.104     | 69d9cde5-e06d-4ecf-9f87-0f91cb06a653 |
| ab40dcbd-1082-424a-b0fb-135b8756bc91 |                  | 192.168.205.105     |                                      |
| c1e1d2a7-7f5c-4b51-938e-eb064d5d1939 | 172.16.16.3      | 192.168.205.103     | 315b610f-54e1-404c-bac3-048feb37bc23 |
+--------------------------------------+------------------+---------------------+--------------------------------------+


See information of the new instance get the Private network IP of the same.
===============================================================

[root@controller ~(keystone_admin)]# nova list
+--------------------------------------+---------------------------------+--------+------------+-------------+----------------------------------------+
| ID                                   | Name                            | Status | Task State | Power State | Networks                               |
+--------------------------------------+---------------------------------+--------+------------+-------------+----------------------------------------+
| a2c265bb-242c-40ae-ae9c-98849e459bf7 | instance1                       | ACTIVE | -          | Running     | internal1=172.16.16.3, 192.168.205.103 |
| 5d767783-933e-423d-848f-37e816fa05b3 | stack1-my_instance-rrmsgn57cvxy | ACTIVE | -          | Running     | internal1=172.16.16.5                  |
+--------------------------------------+---------------------------------+--------+------------+-------------+----------------------------------------+

Find the neutron port for the instance this information is needed to associate the floating IP to the port of the instance
===============================================================
[root@controller ~(keystone_admin)]# neutron port-list | grep -i 172.16.16.5
| 42304108-f397-4de7-8936-5f011e4be5f3 |      | fa:16:3e:ff:52:0a | {"subnet_id": "bd5b5a96-eaf5-45a8-93e5-6be837e61414", "ip_address": "172.16.16.5"}     |
[root@controller ~(keystone_admin)]#
[root@controller ~(keystone_admin)]#


Associate the floating IP
=================
[root@controller ~(keystone_admin)]# neutron floatingip-associate ab40dcbd-1082-424a-b0fb-135b8756bc91 42304108-f397-4de7-8936-5f011e4be5f3
Associated floating IP ab40dcbd-1082-424a-b0fb-135b8756bc91
[root@controller ~(keystone_admin)]#

Ensure the floating IP is seen to be associated to the instance as in the nova list
========================================================================

[root@controller ~(keystone_admin)]# nova list
+--------------------------------------+---------------------------------+--------+------------+-------------+----------------------------------------+
| ID                                   | Name                            | Status | Task State | Power State | Networks                               |
+--------------------------------------+---------------------------------+--------+------------+-------------+----------------------------------------+
| a2c265bb-242c-40ae-ae9c-98849e459bf7 | instance1                       | ACTIVE | -          | Running     | internal1=172.16.16.3, 192.168.205.103 |
| 5d767783-933e-423d-848f-37e816fa05b3 | stack1-my_instance-rrmsgn57cvxy | ACTIVE | -          | Running     | internal1=172.16.16.5, 192.168.205.105 |
+--------------------------------------+---------------------------------+--------+------------+-------------+----------------------------------------+
[root@controller ~(keystone_admin)]#


you can now use the keys and SSH to the instance.

Please note that the security group for the instance has to have the ingress SSH allowed for a successful SSH to the instance