Ask Your Question
2

Heat AutoScalingGroup with different user data

asked 2015-01-15 01:52:38 -0500

Suppose in my heat template, I have autoscaling resource like this.

resources:
  auto_scale_server:
    type: OS::Heat::AutoScalingGroup
    properties:
      min_size: 1
      max_size: 4
      resource:       
          type: OS::Nova::Server
          properties:
            name: Scaled_Blade
            image: { get_param: image }
            flavor: { get_param: flavor }
            key_name: {get_param: key_pair}
            networks: [{network: {get_param: internal_net} }]  
            user_data:
              str_replace:
                template: |
                  #!/bin/bash 
                  ifconfig eth1 10.0.0.5

I want to assign different IP to each VM, which is created by this group. How can I achieve that ?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2015-01-18 03:44:49 -0500

ccebrian gravatar image

updated 2015-01-26 14:27:32 -0500

zaneb gravatar image

If what you really need to do is to assign a different IP to each VM in the AutoScaling Group, you can achieve it by enabling the DHCP when you create the "internal_net"; so each new machine in the AutoScalingGroup will receive a different internal IP address when created; for example:

  internal_network:
    type: OS::Neutron::Net
    properties:
     name: { get_param: internal_net }
  internal_subnet:
    type: OS::Neutron::Subnet
    properties:
      network: { get_resource: internal_network}
      cidr: 192.168.1.0/24
      # next line enables DHCP
      enable_dhcp: True
      name:
        str_replace:
          template: Sub-NetName
          params:
            NetName: { get_param: internal_net }

Obviously, in this way you must delete the line for assigning an IP at Operating System level (i.e. the line: ifconfig eth1 10.0.0.5); in fact, even you're not creating an autoscaling group, the ideas of specifying and assigning an IP address "by hand" as you dif it's not a good way for Cloud philosophy (you need to manage automatically; else you'll get in a “wok jam" when scaling)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

2 followers

Stats

Asked: 2015-01-15 01:52:38 -0500

Seen: 492 times

Last updated: Jan 26 '15