-
Notifications
You must be signed in to change notification settings - Fork 6
/
postgres.yaml
622 lines (563 loc) · 23.5 KB
/
postgres.yaml
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
heat_template_version: 2017-02-24
description: >
This template deploys PostgreSQL Bi-Directional Replication set on Ubuntu for JAWS
parameters:
sync:
type: boolean
default: False
image:
type: string
default: Ubuntu1604
description: The Ubuntu image to use.
flavor:
type: string
default: m1.large
description: The JAWS flavour database server is to run on
key:
type: string
default: mj
description: Name of an existing KeyPair to enable SSH access to the instances
public_network_id:
type: string
default: non-prod2
stack_name:
type: string
description: Prefix to add to all resources
default: postgres
network_name:
type: string
label: private network to be used
default: mj-private-network
subnet_name:
type: string
label: private network's subnet to be used
default: mj-private-subnet
volume_size:
type: number
description: Database volume size
default: 20
volume_type:
type: string
description: Volume type
default: ceph
proxy_host:
type: string
description: Proxy host for this environment
default: 10.157.240.254
proxy_port:
type: number
description: Proxy time for this environment
default: 8678
db_pass:
type: string
description: Password for root user
default: password
hidden: true
custom_db:
type: string
description: Database to be created
default: app
commandLog:
type: boolean
default: True
isprodvm:
type: string
default: non-prod
az1:
type: string
description: AZ to be used for node1
default: JMNG-PE3-PROD1
az2:
type: string
description: AZ to be used for node2
default: JMNG-PE3-PROD2
az3:
type: string
description: AZ to be used for node2
default: JMNG-PE3-PROD3
sg_type:
type: string
default: default
securityGroup:
type: string
description: security group name
istelegrafon:
type: string
default: stop
conditions:
custom: {equals: [{get_param: sg_type}, "custom"]}
default: {equals: [{get_param: sg_type}, "default"]}
resources:
random_string1:
type: OS::Heat::RandomString
properties:
length: 4
sequence: lowercase
random_string2:
type: OS::Heat::RandomString
properties:
length: 4
sequence: lowercase
random_string3:
type: OS::Heat::RandomString
properties:
length: 4
sequence: lowercase
postgres1_name:
type: OS::Heat::Value
depends_on: random_string1
properties:
value:
str_replace:
template: dbaas-$prefix-$random
params:
$prefix: { get_param: stack_name }
$random: { get_resource: random_string1 }
postgres2_name:
type: OS::Heat::Value
depends_on: random_string2
properties:
value:
str_replace:
template: dbaas-$prefix-$random
params:
$prefix: { get_param: stack_name }
$random: { get_resource: random_string2 }
proxy_name:
type: OS::Heat::Value
depends_on: random_string3
properties:
value:
str_replace:
template: dbaas-$prefix-$random
params:
$prefix: { get_param: stack_name }
$random: { get_resource: random_string3 }
security_group:
type: OS::Neutron::SecurityGroup
properties:
name: { get_param: securityGroup }
description: Default security group created by JAWS console
rules:
- remote_mode: remote_group_id
direction: ingress
- remote_mode: remote_group_id
direction: egress
- direction: egress
- protocol: icmp
- port_range_min: 22
port_range_max: 22
protocol: tcp
- port_range_min: 5432
port_range_max: 5432
protocol: tcp
condition: default
port1:
type: OS::Neutron::Port
depends_on: security_group
properties:
admin_state_up: true
network: { get_param: network_name }
fixed_ips:
- subnet_id: { get_param: subnet_name }
security_groups:
- { if: ["custom", { get_param: securityGroup }, { get_resource: security_group } ] }
port2:
type: OS::Neutron::Port
depends_on: security_group
properties:
admin_state_up: true
network: { get_param: network_name }
fixed_ips:
- subnet_id: { get_param: subnet_name }
security_groups:
- { if: ["custom", { get_param: securityGroup }, { get_resource: security_group } ] }
port3:
type: OS::Neutron::Port
depends_on: security_group
properties:
admin_state_up: true
network: { get_param: network_name }
fixed_ips:
- subnet_id: { get_param: subnet_name }
security_groups:
- { if: ["custom", { get_param: securityGroup }, { get_resource: security_group } ] }
postgres1_floatingip:
type: OS::Neutron::FloatingIP
depends_on: port1
properties:
floating_network_id: { get_param: public_network_id }
port_id: { get_resource: port1 }
postgres2_floatingip:
type: OS::Neutron::FloatingIP
depends_on: port2
properties:
floating_network_id: { get_param: public_network_id }
port_id: { get_resource: port2 }
proxy_floatingip:
type: OS::Neutron::FloatingIP
depends_on: port3
properties:
floating_network_id: { get_param: public_network_id }
port_id: { get_resource: port3 }
postgres1_volume:
type: OS::Cinder::Volume
properties:
image: { get_param: image }
name: { get_attr: [postgres1_name, value] }
size: { get_param: volume_size }
volume_type: { get_param: volume_type }
postgres2_volume:
type: OS::Cinder::Volume
properties:
image: { get_param: image }
name: { get_attr: [postgres2_name, value] }
size: { get_param: volume_size }
volume_type: { get_param: volume_type }
postgres1:
type: OS::Nova::Server
depends_on: port1
properties:
name: { get_attr: [postgres1_name, value] }
flavor: { get_param: flavor }
key_name: { get_param: key }
availability_zone: { get_param: az1 }
block_device_mapping_v2:
- device_name: vda
volume_id: { get_resource: postgres1_volume }
delete_on_termination: True
networks:
- port: { get_resource: port1 }
user_data_format: RAW
metadata: { db_instance: true }
user_data:
str_replace:
params:
$proxy_host: { get_param: proxy_host }
$proxy_port: { get_param: proxy_port }
$db_pass: { get_param: db_pass }
$sync: { get_param: sync }
$commandLog: { get_param: commandLog }
$isprodvm: { get_param: isprodvm}
$db: { get_param: custom_db }
$ip1: { get_attr: [ port1, fixed_ips, 0, ip_address ]}
$ip2: { get_attr: [ port2, fixed_ips, 0, ip_address ]}
$istelegrafon : { get_param: istelegrafon }
template: |
#!/bin/bash
echo "$ip1 postgres1" >> /etc/hosts
echo "$ip2 postgres2" >> /etc/hosts
rm -rf /var/lib/apt/lists/lock
export http_proxy=http://$proxy_host:$proxy_port
export https_proxy=http://$proxy_host:$proxy_port
echo "export http_proxy=http://$proxy_host:$proxy_port" >> /etc/profile.d/proxy.sh
echo "export https_proxy=http://$proxy_host:$proxy_port" >> /etc/profile.d/proxy.sh
curl -o /etc/apt/sources.list https://raw.githubusercontent.com/Mohamedji/DBHeatTemplate/master/sources.list
apt-get update
# Snoopy install
if [ $commandLog = True ]
then
apt-get update -y
apt-get install libtool-bin -y
rm -f snoopy-install.sh
curl -L -o snoopy-install.sh https://github.com/a2o/snoopy/raw/install/doc/install/bin/snoopy-install.sh
chmod 755 snoopy-install.sh
./snoopy-install.sh git-master
chmod -R 755 /var/log/auth.log
snoopy-enable
else
echo "snoopy not installed"
fi
# Installing Docker
apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt-get install docker-ce postgresql-client -y
mkdir -p /etc/systemd/system/docker.service.d/
cat << EOF > /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://$proxy_host:$proxy_port"
Environment="HTTPS_PROXY=http://$proxy_host:$proxy_port"
EOF
systemctl daemon-reload && systemctl restart docker
systemctl enable docker
# Creating PostgreSQL DB
mkdir data
if [ $sync = True ]
then
docker pull jgiannuzzi/postgres-bdr:9.4.17
docker run -d --name postgres1 --hostname postgres1 -p 5432:5432 -v /etc/hosts:/etc/hosts -v data:/var/lib/postgresql/data --restart always -e POSTGRES_PASSWORD=$db_pass jgiannuzzi/postgres-bdr:9.4.17
else
docker pull mohamedji/docker-postgres-bdr
docker run -d --name postgres1 --hostname postgres1 -p 5432:5432 -v /etc/hosts:/etc/hosts -v data:/var/lib/postgresql/data --restart always -e POSTGRES_PASSWORD=$db_pass mohamedji/docker-postgres-bdr
fi
# Installing Telegraf agent
curl -L -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x ./jq
mv jq /usr/bin
echo "serverid=$(sudo curl GET -s 'http://169.254.169.254/openstack/latest/meta_data.json' |jq -r '.uuid' )" >> /etc/default/telegraf
curl -L -O https://dl.influxdata.com/telegraf/releases/telegraf_1.10.3-1_amd64.deb
dpkg -i telegraf_1.10.3-1_amd64.deb
# Telegraf Configuration
mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf-orig.conf
if [ $isprodvm = "non-prod" ]
then
curl -o /etc/telegraf/telegraf.conf https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/telegraf_nonprod.conf
else
curl -o /etc/telegraf/telegraf.conf https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/telegraf_prod.conf
fi
curl -o /etc/telegraf/longrunning.sh https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/longrunning.sh
curl -o /etc/telegraf/commands.sh https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/commands.sh
echo "[[inputs.postgresql]]" >> /etc/telegraf/telegraf.conf
echo " address = 'postgres://postgres:$db_pass@localhost'" >> /etc/telegraf/telegraf.conf
if [ $istelegrafon = "stop" ]
then
systemctl $istelegrafon telegraf
else
systemctl enable telegraf
systemctl $istelegrafon telegraf
fi
postgres2:
type: OS::Nova::Server
depends_on: postgres1
properties:
name: { get_attr: [postgres2_name, value] }
flavor: { get_param: flavor }
key_name: { get_param: key }
availability_zone: { get_param: az2 }
block_device_mapping_v2:
- device_name: vda
volume_id: { get_resource: postgres2_volume }
delete_on_termination: True
networks:
- port: { get_resource: port2 }
user_data_format: RAW
metadata: { db_instance: true }
user_data:
str_replace:
params:
$proxy_host: { get_param: proxy_host }
$proxy_port: { get_param: proxy_port }
$db_pass: { get_param: db_pass }
$sync: { get_param: sync }
$commandLog: { get_param: commandLog }
$isprodvm: { get_param: isprodvm}
$db: { get_param: custom_db }
$ip1: { get_attr: [ port1, fixed_ips, 0, ip_address ]}
$ip2: { get_attr: [ port2, fixed_ips, 0, ip_address ]}
$istelegrafon : { get_param: istelegrafon }
template: |
#!/bin/bash
echo "$ip1 postgres1" >> /etc/hosts
echo "$ip2 postgres2" >> /etc/hosts
rm -rf /var/lib/apt/lists/lock
export http_proxy=http://$proxy_host:$proxy_port
export https_proxy=http://$proxy_host:$proxy_port
echo "export http_proxy=http://$proxy_host:$proxy_port" >> /etc/profile.d/proxy.sh
echo "export https_proxy=http://$proxy_host:$proxy_port" >> /etc/profile.d/proxy.sh
curl -o /etc/apt/sources.list https://raw.githubusercontent.com/Mohamedji/DBHeatTemplate/master/sources.list
apt-get update
# Snoopy install
if [ $commandLog = True ]
then
apt-get update -y
apt-get install libtool-bin -y
rm -f snoopy-install.sh
curl -L -o snoopy-install.sh https://github.com/a2o/snoopy/raw/install/doc/install/bin/snoopy-install.sh
chmod 755 snoopy-install.sh
./snoopy-install.sh git-master
chmod -R 755 /var/log/auth.log
snoopy-enable
else
echo "snoopy not installed"
fi
# Installing Docker
apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt-get install docker-ce postgresql-client -y
mkdir -p /etc/systemd/system/docker.service.d/
cat << EOF > /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://$proxy_host:$proxy_port"
Environment="HTTPS_PROXY=http://$proxy_host:$proxy_port"
EOF
systemctl daemon-reload && systemctl restart docker
systemctl enable docker
# Creating PostgreSQL DB
mkdir data
if [ $sync = True ]
then
docker pull jgiannuzzi/postgres-bdr
docker run -d --name postgres2 --hostname postgres2 -p 5432:5432 -v /etc/hosts:/etc/hosts -v data:/var/lib/postgresql/data --restart always -e POSTGRES_PASSWORD=$db_pass jgiannuzzi/postgres-bdr:9.4.17
else
docker pull mohamedji/docker-postgres-bdr
docker run -d --name postgres2 --hostname postgres2 -p 5432:5432 -v /etc/hosts:/etc/hosts -v data:/var/lib/postgresql/data --restart always -e POSTGRES_PASSWORD=$db_pass mohamedji/docker-postgres-bdr
fi
sleep 10
PGPASSWORD="$db_pass" psql -h $ip1 -U postgres -d postgres -w -p 5432 -c "create database $db;"
PGPASSWORD="$db_pass" psql -h $ip1 -U postgres -d $db -w -p 5432 -c "CREATE EXTENSION IF NOT EXISTS btree_gist;"
PGPASSWORD="$db_pass" psql -h $ip1 -U postgres -d $db -w -p 5432 -c "CREATE EXTENSION IF NOT EXISTS bdr;"
PGPASSWORD="$db_pass" psql -h $ip1 -U postgres -d $db -w -p 5432 -c "SELECT bdr.bdr_group_create(local_node_name := 'postgres1',node_external_dsn := 'host=postgres1 port=5432 dbname=$db password=$db_pass');"
sleep 10
PGPASSWORD="$db_pass" psql -h $ip2 -U postgres -d postgres -w -p 5432 -c "create database $db;"
PGPASSWORD="$db_pass" psql -h $ip2 -U postgres -d $db -w -p 5432 -c "CREATE EXTENSION IF NOT EXISTS btree_gist;"
PGPASSWORD="$db_pass" psql -h $ip2 -U postgres -d $db -w -p 5432 -c "CREATE EXTENSION IF NOT EXISTS bdr;"
PGPASSWORD="$db_pass" psql -h $ip2 -U postgres -d $db -w -p 5432 -c "SELECT bdr.bdr_group_join(local_node_name := 'postgres2',node_external_dsn := 'host=postgres2 port=5432 dbname=$db password=$db_pass', join_using_dsn := 'host=postgres1 port=5432 dbname=$db password=$db_pass');"
# Installing Telegraf agent
curl -L -O https://dl.influxdata.com/telegraf/releases/telegraf_1.10.3-1_amd64.deb
dpkg -i telegraf_1.10.3-1_amd64.deb
# Telegraf Configuration
curl -L -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x ./jq
mv jq /usr/bin
echo "serverid=$(sudo curl GET -s 'http://169.254.169.254/openstack/latest/meta_data.json' |jq -r '.uuid' )" >> /etc/default/telegraf
mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf-orig.conf
if [ $isprodvm = "non-prod" ]
then
curl -o /etc/telegraf/telegraf.conf https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/telegraf_nonprod.conf
else
curl -o /etc/telegraf/telegraf.conf https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/telegraf_prod.conf
fi
curl -o /etc/telegraf/longrunning.sh https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/longrunning.sh
curl -o /etc/telegraf/commands.sh https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/commands.sh
echo "[[inputs.postgresql]]" >> /etc/telegraf/telegraf.conf
echo " address = 'postgres://postgres:$db_pass@localhost'" >> /etc/telegraf/telegraf.conf
if [ $istelegrafon = "stop" ]
then
systemctl $istelegrafon telegraf
else
systemctl enable telegraf
systemctl $istelegrafon telegraf
fi
proxy:
type: OS::Nova::Server
depends_on: port3
properties:
name: { get_attr: [proxy_name, value] }
flavor: { get_param: flavor }
key_name: { get_param: key }
availability_zone: { get_param: az3 }
block_device_mapping_v2:
- device_name: vda
image: { get_param: image }
volume_size: { get_param: volume_size }
delete_on_termination: True
networks:
- port: { get_resource: port3 }
user_data_format: RAW
metadata: { db_instance: true }
user_data:
str_replace:
params:
$proxy_host: { get_param: proxy_host }
$proxy_port: { get_param: proxy_port }
$commandLog: { get_param: commandLog }
$isprodvm: { get_param: isprodvm}
$ip1: { get_attr: [ port1, fixed_ips, 0, ip_address ]}
$ip2: { get_attr: [ port2, fixed_ips, 0, ip_address ]}
$istelegrafon : { get_param: istelegrafon }
template: |
#!/bin/bash
rm -rf /var/lib/apt/lists/lock
export http_proxy=http://$proxy_host:$proxy_port
export https_proxy=http://$proxy_host:$proxy_port
echo "export http_proxy=http://$proxy_host:$proxy_port" >> /etc/profile.d/proxy.sh
echo "export https_proxy=http://$proxy_host:$proxy_port" >> /etc/profile.d/proxy.sh
curl -o /etc/apt/sources.list https://raw.githubusercontent.com/Mohamedji/DBHeatTemplate/master/sources.list
apt-get update && apt-get upgrade -y
# Snoopy install
if [ $commandLog = True ]
then
apt-get update -y
apt-get install libtool-bin -y
rm -f snoopy-install.sh
curl -L -o snoopy-install.sh https://github.com/a2o/snoopy/raw/install/doc/install/bin/snoopy-install.sh
chmod 755 snoopy-install.sh
./snoopy-install.sh git-master
chmod -R 755 /var/log/auth.log
snoopy-enable
else
echo "snoopy not installed"
fi
apt-get install haproxy -y
echo "listen postgre" >> /etc/haproxy/haproxy.cfg
echo " bind *:5432" >> /etc/haproxy/haproxy.cfg
echo " mode tcp" >> /etc/haproxy/haproxy.cfg
echo " balance source" >> /etc/haproxy/haproxy.cfg
echo " server postgre1 $ip1:5432 check inter 10s fastinter 2s downinter 3s rise 3 fall 3" >> /etc/haproxy/haproxy.cfg
echo " server postgre2 $ip2:5432 check inter 10s fastinter 2s downinter 3s rise 3 fall 3" >> /etc/haproxy/haproxy.cfg
systemctl enable haproxy
systemctl restart haproxy
# Installing Telegraf agent
curl -L -O https://dl.influxdata.com/telegraf/releases/telegraf_1.10.3-1_amd64.deb
dpkg -i telegraf_1.10.3-1_amd64.deb
# Telegraf Configuration
curl -L -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x ./jq
mv jq /usr/bin
echo "serverid=$(sudo curl GET -s 'http://169.254.169.254/openstack/latest/meta_data.json' |jq -r '.uuid' )" >> /etc/default/telegraf
mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf-orig.conf
if [ $isprodvm = "non-prod" ]
then
curl -o /etc/telegraf/telegraf.conf https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/telegraf_nonprod.conf
else
curl -o /etc/telegraf/telegraf.conf https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/telegraf_prod.conf
fi
curl -o /etc/telegraf/longrunning.sh https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/longrunning.sh
curl -o /etc/telegraf/commands.sh https://raw.githubusercontent.com/mayankkapoor/statuscheck/master/commands.sh
if [ $istelegrafon = "stop" ]
then
systemctl $istelegrafon telegraf
else
systemctl enable telegraf
systemctl $istelegrafon telegraf
fi
outputs:
db_engine:
description: Database engine name
value: Postgres
db_engine_version:
description: Database Version
value: PostgreSQL v9.4.17
keypair:
description: Keypair to connect to Database instances
value: { get_param: key }
flavor:
description: Database instance flavor
value: { get_param: flavor }
network_name:
description: Database network
value: { get_param: network_name }
subnet_name:
description: Database subnet
value: { get_param: subnet_name }
nodes_pubip:
description: Database instance public ip
value:
str_replace:
template: $host1,$host2,$host3(proxy)
params:
$host1: { get_attr: [postgres1_floatingip, floating_ip_address] }
$host2: { get_attr: [postgres2_floatingip, floating_ip_address] }
$host3: { get_attr: [proxy_floatingip, floating_ip_address] }
nodes_pvtip:
description: Database instance private ip
value:
str_replace:
template: $pvtip1,$pvtip2,$pvtip3
params:
$pvtip1: { get_attr: [port1, fixed_ips, 0, ip_address] }
$pvtip2: { get_attr: [port2, fixed_ips, 0, ip_address] }
$pvtip3: { get_attr: [port3, fixed_ips, 0, ip_address] }
connection_url:
description: PostgreSQL connection url
value:
str_replace:
template: postgresql://postgres:$pass@$host3:5432/$db
params:
$host3: { get_attr: [proxy_floatingip, floating_ip_address] }
$pass: { get_param: db_pass }
$db: { get_param: custom_db }