[Openstack] parameterizing server creation

Sashan Govender sashang at gmail.com
Tue Mar 27 05:28:05 UTC 2018


Awesome, thanks!

On Tue, Mar 27, 2018 at 4:22 PM Rathnakumar Kayyar <rkayyar at lcnpl.com>
wrote:

> You can use ResourceGroups. Here is a snippet from a resource file I have
> created:
>
>   my_server_instance:
>     type: OS::Nova::Server
>     properties:
>       image: { get_param: image }
>       flavor: { get_param: flavor }
> #      key_name: { get_param: key }
>       availability_zone: { get_param: [avl_zones, get_param: index ]}
>       networks:
>         - port: { get_resource: myport}
>
> and the 'deployment' file from where I instantiate the resource (not
> complete, removed stuff for simplicity). Note usage of index, lets you
> address individual servers.
>
>   my_cluster:
>     type: OS::Heat::ResourceGroup
>     properties:
>       count: { get_param: my_cluster_size }
>       resource_def:
>         type: myresource
>         properties:
>           image: "someimage"
>           index: "%index%"
>
> (Assumed that there is a registry as below:
>
> resource_registry:
>   myresource: myresourcefile.yaml
>
> I know this is patchy, but I think provides all required clues.
> rk
>
>
> On 3/27/2018 9:01 AM, Sashan Govender wrote:
>
> Hi
>
> I have a HOT file that has 4 Nova::Server resources. They differences
> between them are minimal and, when I look at the file, I see a lot of
> duplication. How can I reduce this. I've tried fiddling with the 'repeat'
> intrinsic and StructuredConfig but with no luck. I basically want to create
> a loop like the following in the pseudo code:
>
> list_of_servers = ["s1", "s2", "s3", "s4"]
> for server_name in list_of_servers:
>     create_server(server_name)
>
>
>
>
> _______________________________________________
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to     : openstack at lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>
>
> --
> Rathnakumar Kayyar
> LCNhttp://www.lcnpl.com
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> <#m_-253925584345964665_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20180327/38fdc6fe/attachment.html>


More information about the Openstack mailing list