Ask Your Question
0

Push in IP address of all images in ResourceGroup on provision

asked 2016-12-07 09:05:27 -0500

toddbaumann gravatar image

I am trying to provision a set of servers that need to know about each other in the resource group. I was able to do this before by using

  server-1:
    type: OS::Nova::Server
    properties:
      flavor: { get_param: flavor }
      image: { get_param: image }
      key_name: { get_param: key }
      name: server-1
      networks:
        - port : { get_resource: server1_server_port }
      user_data_format: SOFTWARE_CONFIG
      user_data: { get_resource: server1_config }
  server1_server_port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_param: private_net }

In this deployment I could do

- content:
              str_replace:
                template: |
                  server.1=$intip1
                  server.2=$intip2
                  server.3=$intip3
                params:
                  $intip1: { get_attr: [ server1_server_port, fixed_ips, 0, ip_address ]}
                  $intip2: { get_attr: [ server2_server_port, fixed_ips, 0, ip_address ]}
                  $intip3: { get_attr: [ server3_server_port, fixed_ips, 0, ip_address ]}
 path: /root/config.cfg
 permissions: 0750

I want to move to a resourcegroup for a few reasons and am using

serverresourcegroup:
    type: OS::Heat::ResourceGroup
    update_policy:
      rolling_update:
        min_in_service: 2
    properties:
      count: 3
      resource_def:
        type: OS::Nova::Server
        properties:
          flavor: { get_param: flavor }
          image: { get_param: image_name }
          key_name: { get_param: key }
          name: server-%index%
          networks:
          - network: { get_param: private_net }
          user_data_format: SOFTWARE_CONFIG
          user_data: { get_resource: server_config }

The problem I have is I have no way of using OS::Neutron::Port to query to get the IP address on instantiation.

Does anyone know of a way during spin up that these servers can know the IP address of the other servers like I could before by using the OS::Neutron::Port resource ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-12-15 10:09:13 -0500

zaneb gravatar image

If you want to define the Port as a separate resource then the type of the resource_def can be the name of a template which contains both the server and the port. That doesn't solve your problem of making all of the servers know about each other though.

The recommended way to do that is with an OS::Heat::SoftwareDeploymentGroup resource. That essentially deploys the same software deployment on a list of servers, so you can use it to e.g. write all of the IPs to /etc/hosts on every server. Both the list of servers to deploy on and the list of IPs to pass as input can be obtained from the ResourceGroup.

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: 2016-12-07 09:05:27 -0500

Seen: 158 times

Last updated: Dec 15 '16