blob: c3cbe1bb847931ba07b3ff7ea724907a84a9337a [file] [log] [blame]
Oleg Basov5c426192019-02-05 17:00:35 +01001heat_template_version: 2013-05-23
2
3description:
4 This Heat template creates a new Neutron network, a router to the external
5 network and plugs instances into this new network. All instances are located
6 in the same L2 domain.
7
8parameters:
9 image:
10 type: string
11 description: Name of image to use for servers
12 flavor:
13 type: string
14 description: Flavor to use for servers
15 external_net:
16 type: string
17 description: ID or name of external network
18 server_endpoint:
19 type: string
20 description: Server endpoint address
21 dns_nameservers:
22 type: comma_delimited_list
23 description: DNS nameservers for the subnet
24
25resources:
26 qos_policy:
27 type: OS::Neutron::QoSPolicy
28
29 bandwidth_limit_rule:
30 type: OS::Neutron::QoSBandwidthLimitRule
31 properties:
32 policy: { get_resource: qos_policy }
33 max_kbps: 10000
34 max_burst_kbps: 10000
35
36 private_net:
37 type: OS::Neutron::Net
38 properties:
39 name: {{ unique }}_net
40 qos_policy: { get_resource: qos_policy }
41
42 private_subnet:
43 type: OS::Neutron::Subnet
44 properties:
45 network_id: { get_resource: private_net }
46 cidr: 10.0.0.0/16
47 dns_nameservers: { get_param: dns_nameservers }
48
49 router:
50 type: OS::Neutron::Router
51 properties:
52 external_gateway_info:
53 network: { get_param: external_net }
54
55 router_interface:
56 type: OS::Neutron::RouterInterface
57 properties:
58 router_id: { get_resource: router }
59 subnet_id: { get_resource: private_subnet }
60
61 server_security_group:
62 type: OS::Neutron::SecurityGroup
63 properties:
64 rules: [
65 {remote_ip_prefix: 0.0.0.0/0,
66 protocol: tcp,
67 port_range_min: 1,
68 port_range_max: 65535},
69 {remote_ip_prefix: 0.0.0.0/0,
70 protocol: udp,
71 port_range_min: 1,
72 port_range_max: 65535},
73 {remote_ip_prefix: 0.0.0.0/0,
74 protocol: icmp}]
75
76{% for agent in agents.values() %}
77
78 {{ agent.id }}:
79 type: OS::Nova::Server
80 properties:
81 name: {{ agent.id }}
82 image: { get_param: image }
83 flavor: { get_param: flavor }
84 availability_zone: "{{ agent.availability_zone }}"
85 networks:
86 - port: { get_resource: {{ agent.id }}_port }
87 user_data_format: RAW
88 user_data:
89 str_replace:
90 template: |
91 #!/bin/sh
92 screen -dmS shaker-agent-screen shaker-agent --server-endpoint=$SERVER_ENDPOINT --agent-id=$AGENT_ID
93 params:
94 "$SERVER_ENDPOINT": { get_param: server_endpoint }
95 "$AGENT_ID": {{ agent.id }}
96
97 {{ agent.id }}_port:
98 type: OS::Neutron::Port
99 properties:
100 network_id: { get_resource: private_net }
101 fixed_ips:
102 - subnet_id: { get_resource: private_subnet }
103 security_groups: [{ get_resource: server_security_group }]
104
105{% endfor %}
106
107outputs:
108{% for agent in agents.values() %}
109 {{ agent.id }}_instance_name:
110 value: { get_attr: [ {{ agent.id }}, instance_name ] }
111 {{ agent.id }}_ip:
112 value: { get_attr: [ {{ agent.id }}, networks, { get_attr: [private_net, name] }, 0 ] }
113{% endfor %}