Ask Your Question
0

Can you specify user_data in the .template type referenced by OS::Heat::AutoScalingGroup or does it have to be provided in the OS::Heat::AutoScalingGroup user_data?

asked 2014-09-16 09:29:18 -0600

Heather gravatar image

updated 2014-09-16 13:11:49 -0600

mpetason gravatar image

The main HOT document resource:

  tomcat_server_group:
    type: OS::Heat::AutoScalingGroup
    properties:
      cooldown: { get_param: cooldown_period }
      desired_capacity: { get_param: desired_capacity_requested }
      max_size: { get_param: max_capacity_requested }
      min_size: { get_param: min_capacity_requested }
      #rolling_updates: {"min_in_service": 1, "pause_time": 180, "max_batch_size": 1}
      resource:
        type: sprint8_tomcat_server.template
        properties:
          key_name: { get_param:  ssh_key_name }
          image: { get_param: image_id }
          flavor: { get_param: instance_type }

the .template file:

resources:



 #############################################################
  # Define the application server (Tomcat)
  #############################################################
  tomcat_server:
    type: OS::Nova::Server
    properties:
      key_name: { get_param:  ssh_key_name }
       image: { get_param: image_id }
       flavor: { get_param: instance_type }
       networks:
         - port: { get_resource: tomcat_server_port }
       user_data:
         str_replace:
           template: { get_file:  "http://haasaet.web.att.com/depot/hot-skel.sh" }
           params:
             $APP_HOST_IP_ENV: { get_param: db_server_ip }
             $HOTSKEL1: { get_file:  "http://haasaet.web.att.com/depot/deploy-chef-client-as3525.sh" }
             $HOTSKEL2: { get_file:  "http://haasaet.web.att.com/depot/milestone2-app-only.sh" }

  tomcat_server_port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_resource: CustNetZone1 }
      fixed_ips:
        - subnet_id: { get_resource: Zone1_Subnet }
      security_groups: [{ get_resource: server_security_group }]

I'm getting this error:

Create_Failed: Resource CREATE failed: StackValidationFailed: Property error : 3xjnxxmvpbgo: Property user_data not assigned
edit retag flag offensive close merge delete

Comments

Does your sprint8_tomcat_server.template file have a parameters section?

larsks gravatar imagelarsks ( 2014-09-16 14:52:41 -0600 )edit

Yes, it does.

Heather gravatar imageHeather ( 2014-09-17 07:25:37 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2014-09-16 21:53:11 -0600

larsks gravatar image

updated 2014-09-16 21:53:33 -0600

The user_data key is a property of the OS::Nova::Server resource...so anywhere you have an OS::Nova::Server, you can specify a user_data property. The error you are getting suggests that your nested template has a parameters section with a user_data property that has no default (making it a required property). If that's the case, you can simply remote it from your parameters section if you don't need it.

This repository has some examples that do exactly what you're trying to do -- provide a user_data property to an OS::Nova::Server resource that is part of a nested stack included from another stack. In particularly, look at wp-scaling-lb.yaml and the nested template, wp-nested-server-lb.yaml.

edit flag offensive delete link more

Comments

These examples are very helpful. From this I see more clearly how this is supposed to work, and it does what I wanted it to do. Once I test and validate my work I'll answer my own question. Thanks!!

Heather gravatar imageHeather ( 2014-09-17 08:20:41 -0600 )edit
0

answered 2014-09-17 15:29:58 -0600

Heather gravatar image

OK, the answer is embarrassing, but here it is. When I changed the .template file to do the user_data work I just copied my original two files and modified them. I forgot to change the name of the template in the new main HOT doc so I kept getting the same error. Once I fixed that the stack would build. The examples, however, taught me a lot on how to approach this and I fixed about 8 other things because asking this question. Still working on getting it to scale up a server, but it is an unrelated issue I'm working through. Thanks for the help!

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

1 follower

Stats

Asked: 2014-09-16 09:29:18 -0600

Seen: 2,082 times

Last updated: Sep 17 '14