1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
heat_template_version: 2013-05-23
description:
This Heat template creates a pair of networks plugged into the same router.
Master instances and slave instances are connected into different networks.
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 for which floating IP addresses will be allocated
# server_endpoint:
# type: string
# description: Server endpoint address
dns_nameservers:
type: comma_delimited_list
description: DNS nameservers for the subnets
resources:
east_private_net:
type: OS::Neutron::Net
properties:
name: {{ unique }}_net_east
east_private_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: east_private_net }
cidr: 10.1.0.0/16
dns_nameservers: { get_param: dns_nameservers }
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: east_private_subnet }
west_private_net:
type: OS::Neutron::Net
properties:
name: {{ unique }}_net_west
west_private_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: west_private_net }
cidr: 10.2.0.0/16
dns_nameservers: { get_param: dns_nameservers }
router_interface_2:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router }
subnet_id: { get_resource: west_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}]
{% for agent in agents.values() %}
{{ agent.id }}:
type: OS::Nova::Server
properties:
name: {{ agent.id }}
image: { get_param: image }
flavor: { get_param: flavor }
availability_zone: "{{ agent.availability_zone }}"
networks:
- port: { get_resource: {{ agent.id }}_port }
{% if agent.mode == 'master' %}
{{ agent.id }}_port:
type: OS::Neutron::Port
properties:
network_id: { get_resource: east_private_net }
fixed_ips:
- subnet_id: { get_resource: east_private_subnet }
security_groups: [{ get_resource: server_security_group }]
{% else %}
{{ agent.id }}_port:
type: OS::Neutron::Port
properties:
network_id: { get_resource: west_private_net }
fixed_ips:
- subnet_id: { get_resource: west_private_subnet }
security_groups: [{ get_resource: server_security_group }]
{% endif %}
{% endfor %}
outputs:
{% for agent in agents.values() %}
{{ agent.id }}_instance_name:
value: { get_attr: [ {{ agent.id }}, instance_name ] }
{% if agent.mode == 'master' %}
{{ agent.id }}_ip:
value: { get_attr: [ {{ agent.id }}, networks, { get_attr: [east_private_net, name] }, 0 ] }
{% else %}
{{ agent.id }}_ip:
value: { get_attr: [ {{ agent.id }}, networks, { get_attr: [west_private_net, name] }, 0 ] }
{% endif %}
{% endfor %}
|