Last active
February 20, 2019 21:36
-
-
Save cloudnull/36c92e0da5e61b13510560ae15227453 to your computer and use it in GitHub Desktop.
Using heat create a mess of servers and give all of them floating IP addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat_template_version: 2015-04-30 | |
description: > | |
HOT template to deploy multiple servers using a float | |
parameters: | |
key_name: | |
type: string | |
description: Name of keypair to assign to servers | |
image: | |
type: string | |
description: Name of image to use for servers | |
flavor: | |
type: string | |
description: Flavor to use for servers | |
public_net_id: | |
type: string | |
description: > | |
ID of public network for which floating IP addresses will be allocated | |
private_net_id: | |
type: string | |
description: ID of private network into which servers get deployed | |
private_subnet_id: | |
type: string | |
description: ID of private sub network into which servers get deployed | |
server_count: | |
type: number | |
description: Number of server you with to build | |
resources: | |
server_group: | |
type: OS::Heat::ResourceGroup | |
properties: | |
count: { get_param: server_count } | |
resource_def: | |
type: server_and_float.yaml | |
properties: | |
name: BUILD_TEST_%index% | |
image: { get_param: image } | |
flavor: { get_param: flavor } | |
key_name: { get_param: key_name } | |
public_net_id: { get_param: public_net_id } | |
private_net_id: { get_param: private_net_id } | |
private_subnet_id: { get_param: private_subnet_id } | |
outputs: | |
server_resources: | |
description: Servers in use | |
value: { get_attr: [server_group, refs]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat_template_version: 2013-05-23 | |
description: > | |
Deploy a server and attach a floating IP address | |
parameters: | |
key_name: | |
type: string | |
description: Name of keypair to assign to servers | |
image: | |
type: string | |
description: Name of image to use for servers | |
name: | |
type: string | |
description: Name of the server | |
flavor: | |
type: string | |
description: Flavor to use for servers | |
public_net_id: | |
type: string | |
description: > | |
ID of public network for which floating IP addresses will be allocated | |
private_net_id: | |
type: string | |
description: ID of private network into which servers get deployed | |
private_subnet_id: | |
type: string | |
description: ID of private sub network into which servers get deployed | |
resources: | |
server: | |
type: OS::Nova::Server | |
properties: | |
name: { get_param: name } | |
image: { get_param: image } | |
flavor: { get_param: flavor } | |
key_name: { get_param: key_name } | |
networks: | |
- port: { get_resource: server_port } | |
server_port: | |
type: OS::Neutron::Port | |
properties: | |
network_id: { get_param: private_net_id } | |
fixed_ips: | |
- subnet_id: { get_param: private_subnet_id } | |
security_groups: [default] | |
server_floating_ip: | |
type: OS::Neutron::FloatingIP | |
properties: | |
floating_network_id: { get_param: public_net_id } | |
port_id: { get_resource: server_port } | |
outputs: | |
server_private_ip: | |
description: IP address of server in private network | |
value: { get_attr: [ server, first_address ] } | |
server_public_ip: | |
description: Floating IP address of server in public network | |
value: { get_attr: [ server_floating_ip, floating_ip_address ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat stack-create \ | |
BUILD_TEST -f build-server.yaml -P "key_name=${KEY_NAME}" \ | |
-P "image=${IMAGE_ID}" \ | |
-P "public_net_id=${PUBLIC_NET_ID}" \ | |
-P "private_net_id=${PRIVATE_NET_ID}" \ | |
-P "private_subnet_id=${PRIVATE_SUBNET_ID}" \ | |
-P "flavor=${FLAVOR_NAME}" \ | |
-P "server_count=${NODE_COUNT}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment