forked from redhat-cip/openstack-yaml-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheat.yaml.tmpl
202 lines (180 loc) · 6.12 KB
/
heat.yaml.tmpl
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
heat_template_version: 2013-05-23
description: >
Full setup of an OpenStack reference architecture from eNovance
parameters:
dist:
type: string
description: Linux distribution codename
release:
type: string
description: Release codename
resources:
mysecgroup:
type: OS::Neutron::SecurityGroup
properties:
rules: [
{remote_ip_prefix: 0.0.0.0/0,
protocol: tcp,
port_range_min: 22,
port_range_max: 22},
{remote_ip_prefix: 0.0.0.0/0,
protocol: tcp,
port_range_min: 8282,
port_range_max: 8282},
{remote_ip_prefix: 0.0.0.0/0,
protocol: tcp,
port_range_min: 3000,
port_range_max: 3000},
{remote_ip_prefix: 0.0.0.0/0,
protocol: tcp,
port_range_min: 8300,
port_range_max: 8300},
{remote_ip_prefix: {{ config.internal_network }},
protocol: tcp,
port_range_min: 1,
port_range_max: 65535},
{remote_ip_prefix: {{ config.internal_network }},
protocol: udp,
port_range_min: 1,
port_range_max: 65535},
{remote_ip_prefix: 0.0.0.0/0,
protocol: icmp},
{remote_ip_prefix: 0.0.0.0/0,
protocol: "112"}]
{{ config.private_net_name }}:
type: OS::Neutron::Net
private_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: {{ config.private_net_name }} }
cidr: {{ config.internal_network }}
dns_nameservers:{% for dnsip in config.dns_ips %}
- {{ dnsip }}{% endfor %}
enable_dhcp: true
allocation_pools: [{"start": {{ config.internal_network_start_ip }}, "end": {{ config.internal_network_end_ip }}}]
vip_port:
type: OS::Neutron::Port
properties:
network_id: { get_resource: {{ config.private_net_name }} }
fixed_ips:
- subnet_id: { get_resource: private_subnet }
ip_address: {{ config.vip_admin_ip }}
security_groups: [{ get_resource: mysecgroup }]
{% if floating_network_id %}
router:
type: OS::Neutron::Router
router_gateway:
type: OS::Neutron::RouterGateway
properties:
router_id: { get_resource: router }
network_id: {{ floating_network_id }}
router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router }
subnet_id: { get_resource: private_subnet }
install_server_public_ip:
type: OS::Neutron::FloatingIP
properties:{% for hname in hosts -%}{% if hosts[hname].profile == 'install-server' %}
port_id: { get_resource: {{ hname }}_port }
floating_network_id: {{ floating_network_id }}
vip_public_ip:
type: OS::Neutron::FloatingIP
properties:
port_id: { get_resource: vip_port }
floating_network_id: {{ floating_network_id }}
{% endif -%}
{% endfor -%}
{% endif -%}
{% for hname in hosts %}
{{ hname }}_port:
type: OS::Neutron::Port
properties:
network_id: { get_resource: {{ config.private_net_name }} }
{% if hosts[hname].profile == 'load-balancer' %} allowed_address_pairs:
- ip_address: {{ config.vip_admin_ip }}{% endif %}
fixed_ips:
- subnet_id: { get_resource: private_subnet }
ip_address: {{ hosts[hname].ip }}
security_groups: [{ get_resource: mysecgroup }]
{{ hname }}:
type: OS::Nova::Server
properties:
image:
str_replace:
template: profile-dist-release
params:
profile: {{ profiles[hosts[hname].profile].edeploy }}
dist: { get_param: dist}
release: { get_param: release}
{% if hosts[hname].profile == 'install-server' %} flavor: {{ config.flavor_install_server }}{% else %} flavor: {{ config.flavor_openstack_full }}{% endif %}
networks:
- port: { get_resource: {{ hname }}_port }
user_data_format: RAW
user_data: |
#cloud-config
hostname: {{ hname }}
fqdn: {{ hname }}.{{ config.domain}}
manage_etc_hosts: false
groups:
- {{ config.remote_user }}
users:
- default
- name: {{ config.remote_user }}
primary-group: {{ config.remote_user }}
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
ssh_keys:
rsa_private: |
{{ config.jenkins_private_key|indent(16)}}
ssh-authorized-keys:{% for key in config.ssh_authorized_keys %}
- {{ key }}{% endfor %}
write_files:
- path: /etc/sudoers.d/999-jenkins-cloud-init-requiretty
permissions: 0440
content: |
Defaults:jenkins !requiretty
{% if config.puppetdb_pem and hosts[hname].profile == 'install-server' %} - path: /etc/ssl/certs/puppetdb.pem
permissions: 0400
owner: root:root
content: |
{{ config.puppetdb_pem|indent(14) }}{% endif -%}
{% if hosts[hname].profile == 'storage' -%}
{% for dev in config.ceph_osd_devices %}
{{ hname }}_{{ dev }}:
type: OS::Cinder::Volume
properties:
size: {{ config.volume_size }}
{{ hname }}_{{ dev }}_attachment:
type: OS::Cinder::VolumeAttachment
properties:
volume_id: { get_resource: {{ hname }}_{{ dev }} }
instance_uuid: { get_resource: {{ hname }} }
mountpoint: /dev/{{ dev }}
{% endfor -%}
{% for dev in config.swift_storage_devices %}
{{ hname }}_{{ dev }}:
type: OS::Cinder::Volume
properties:
size: {{ config.volume_size }}
{{ hname }}_{{ dev }}_attachment:
type: OS::Cinder::VolumeAttachment
properties:
volume_id: { get_resource: {{ hname }}_{{ dev }} }
instance_uuid: { get_resource: {{ hname }} }
mountpoint: /dev/{{ dev }}
{% endfor -%}
{% endif -%}
{% endfor %}
{% if floating_network_id %}
outputs:
output_install_server_public_ip:
description: Floating IP address of the install server in the public network
value: { get_attr: [ install_server_public_ip, floating_ip_address ] }
output_vip_public_ip:
description: Floating IP address of the VIP in the public network
value: { get_attr: [ vip_public_ip, floating_ip_address ] }
{% endif %}
# Local variables:
# mode: yaml
# End: