shaker/scenarios/misc/instance_metadata.hot
Ilya Shakhat 071a9c883a Add scenario sample that retrieves instances' metadata
Change-Id: If87ca6b65174561ea348518d09fbcc39de590a39
2015-04-08 15:28:52 +03:00

111 lines
2.9 KiB
Plaintext

heat_template_version: 2013-05-23
description:
HOT template creates a new neutron network, a router to the external
network, plugs servers into this new network and assigns floating ips
parameters:
image:
type: string
description: Name of image to use for servers
flavor:
type: string
description: Flavor to use for servers
external_net:
type: string
description: ID or name of external network
server_endpoint:
type: string
description: Server endpoint address
resources:
private_net:
type: OS::Neutron::Net
properties:
name: {{ unique }}_net
private_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: private_net }
cidr: 10.0.0.0/16
dns_nameservers: [ 8.8.8.8, 8.8.4.4 ]
router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: { get_param: external_net }
router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router }
subnet_id: { get_resource: private_subnet }
server_security_group:
type: OS::Neutron::SecurityGroup
properties:
rules: [
{remote_ip_prefix: 0.0.0.0/0,
protocol: tcp,
port_range_min: 1,
port_range_max: 65535},
{remote_ip_prefix: 0.0.0.0/0,
protocol: udp,
port_range_min: 1,
port_range_max: 65535},
{remote_ip_prefix: 0.0.0.0/0,
protocol: icmp}]
the_key:
type: OS::Nova::KeyPair
properties:
name: {{ unique }}_key
{% for agent in agents.values() %}
{{ agent.id }}:
type: OS::Nova::Server
properties:
name: {{ agent.id }}
image: { get_param: image }
flavor: { get_param: flavor }
key_name: { get_resource: the_key }
availability_zone: "nova:{{ agent.node }}"
networks:
- port: { get_resource: {{ agent.id }}_port }
user_data_format: RAW
user_data:
str_replace:
template: |
#!/bin/sh
screen -dmS shaker-agent-screen shaker-agent --server-endpoint=$SERVER_ENDPOINT --agent-id=$AGENT_ID
params:
"$SERVER_ENDPOINT": { get_param: server_endpoint }
"$AGENT_ID": {{ agent.id }}
{{ agent.id }}_port:
type: OS::Neutron::Port
properties:
network_id: { get_resource: private_net }
fixed_ips:
- subnet_id: { get_resource: private_subnet }
security_groups: [{ get_resource: server_security_group }]
{{ agent.id }}_floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: { get_param: external_net }
port_id: { get_resource: {{ agent.id }}_port }
{% endfor %}
outputs:
{% for agent in agents.values() %}
{{ agent.id }}_instance_name:
value: { get_attr: [ {{ agent.id }}, instance_name ] }
{{ agent.id }}_ip:
value: { get_attr: [ {{ agent.id }}, networks, { get_attr: [private_net, name] }, 0 ] }
{% endfor %}