Ask Your Question
1

Heat::ResourceGroup [closed]

asked 2018-06-26 15:47:10 -0600

Erik Launay gravatar image

updated 2018-06-26 15:58:27 -0600

Hi

I have been using HEAT template to create 3 servers and it works just fine

Example:

  ALIS-MF-01:
    type: OS::Nova::Server
    properties:
      name: ALIS-MF-01
      …
       template: {get_file: alis-mf-script.sh }
          params:
            …
            $alis_mf_hostname: { get_param: alis_mf_01_hostname }
            ...

  ALIS-MF-02:
    type: OS::Nova::Server
    properties:
      name: ALIS-MF-02
      …
       template: {get_file: alis-mf-script.sh }
          params:
            …
            $alis_mf_hostname: { get_param: alis_mf_02_hostname }
            ...

  ALIS-MF-03:
    type: OS::Nova::Server
    properties:
      name: ALIS-MF-03
      …
       template: {get_file: alis-mf-script.sh }
          params:
            …
            $alis_mf_hostname: { get_param: alis_mf_03_hostname }
            ...

Which as I said works just fine. Note: alis_mf_01_hostname, alis_mf_02_hostname and alis_mf_03_hostname are provided by my environment file

Now I would like to use Heat::ResourceGroup

  alis_af_rg:
    type: OS::Heat::ResourceGroup
    properties:
      count: { get_param: alis_af_count }
      resource_def:
        type: aqsa_alis_af.yaml
        properties:
           …
          alis_mf_hostname: { get_param: alis_mf_hostname }

The question is, before using Nova:Server, I could distinct the hostname as I was creating 3 different instances (alis_mf_01_hostname, alis_mf_02_hostname and alis_mf_03_hostname)

How can I provide a different hostname using ResourceGroup?

Anybody please?

Just for the story: I already did my research here and couldn't any clue.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Erik Launay
close date 2018-07-16 13:49:16.541525

2 answers

Sort by » oldest newest most voted
1

answered 2018-07-16 13:41:12 -0600

Erik Launay gravatar image

updated 2018-07-16 13:48:12 -0600

I figured out how to address this issue:

As an example from what I did:

  • In my environment file, I have:

        alis_mf_hostname_list: "alis-mf01,alis-mf02,alis-mf03"
    
  • In my heat template (the base template), I have:

        alis_mf_hostname_list:
    
        type: comma_delimited_list
    
        label: ALIS-MF-BB Hostname list
    
         description: ALIS-MF-BB Hostname list
    
        default: "alis-mf01,alis-mf02,alis-mf03"
    

Then

        properties:

        flavor: { get_param: alis_mf_flavor }

        alis_mf_hostname_list: { get_param: alis_mf_hostname_list }

        id: "%index%"
  • In my heat template

        $alis_mf_hostname: { get_param: [alis_mf_hostname_list, get_param: id] }
    
edit flag offensive delete link more
1

answered 2018-06-27 00:29:59 -0600

Resource groups have an index feature. Would that help your case?

This is the example from the documentation:

resources:
  my_indexed_group:
    type: OS::Heat::ResourceGroup
    properties:
      count: 3
      resource_def:
        type: OS::Nova::Server
        properties:
          # create a unique name for each server using its index in the group
          name: my_server_%index%
edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2018-06-26 15:47:10 -0600

Seen: 149 times

Last updated: Jul 16