-
Notifications
You must be signed in to change notification settings - Fork 1
/
was.yaml
603 lines (537 loc) · 20.1 KB
/
was.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
heat_template_version: 2013-05-23
description: >
A document-based template to configure your Software Defined Environment.
parameters:
############################
# Server parameters
############################
flavor:
type: string
description: Flavor to be used for compute instance
label: Flavor
constraints:
- custom_constraint: nova.flavor
key_name:
type: string
description: 'For most clouds, the name of the key-pair to be used for the compute instance; for VMware clouds, the contents of the public SSH key for the compute instance'
label: SSH Key name
constraints:
- custom_constraint: nova.keypair
network-id__for__patterns-service-dev-net:
type: string
description: 'Generated to reference ''patterns-service-dev-net'' network.'
default: 'fbd19302-f247-4816-b53e-a664f3dc72c1'
subnet_id_46fcd6d7-017e-437b-9921-d7fb9f76a7f2:
type: string
description: 'Generated to reference subnet ''46fcd6d7-017e-437b-9921-d7fb9f76a7f2''.'
default: '46fcd6d7-017e-437b-9921-d7fb9f76a7f2'
public_network_id:
type: string
description: 'Generated for floating IP'
default: 'public_network_id'
security_group:
type: string
description: 'Name of the security group'
default: 'default'
availability_zone:
type: string
description: 'Name of availability zone in which to create the instance'
label: Availability zone
default: 'nova'
image_id:
type: string
description: OS Image to deploy onto
label: OS Image
constraints:
- custom_constraint: glance.image
root_password:
description: This is the password for the root user of the system
label: Password (root)
type: string
default: test
hidden: True
virtuser_password:
description: This is the password for the virtuser user of the system
label: Password (virtuser)
type: string
default: test
hidden: True
sw_repo_root:
default: 'http://159.122.222.80/sw_repo/'
description: Software repository URL (e.g. http://x.x.x.x:8080/
label: Software Repository URL
type: string
############################
# Salt Specific Parameters
############################
salt_master_address:
type: string
description: Hostname/IP address of the salt-master
label: Saltmaster address
salt_api_token:
type: string
description: Security token for connecting to Salt API
label: Salt api token
hidden: True
############################
# Server names
############################
was_vm_name:
type: string
description: Name of the virtual machine to deploy
default: ibm_was_v855_02
############################
# WebSphere parameters
############################
was_os_user:
type: string
description: username for the Websphere operating system user
label: WAS OS user
default: wasadmin
was_os_group:
type: string
description: group for the Websphere operating system user
label: WAS OS group
default: wasgrp
was_os_user_password:
type: string
description: password for the Websphere operating system user
label: WAS OS Users password
hidden: True
default: test
was_admin_username:
type: string
description: Admin user login was
label: WAS Console user
default: wasadmin
was_admin_password:
type: string
description: Admin password login was
label: WAS Console password
hidden: True
default: test
was_install_dir:
type: string
description: Install directory of websphere
label: WAS Install directory
default: /opt/IBM/WebSphere/AppServer
was_profile_dir:
type: string
description: Profile directory of websphere node
label: WAS Profile directory
default: /opt/IBM/WebSphere/AppServer/profiles
im_install_dir:
type: string
description: Install directory of InstallationManager
label: Installation Mgr Install directory
default: /opt/IBM/InstallationManager
customer_log_dir_enabled:
type: string
description: Select enable customer log directory
label: Enable custom log location
default: true
constraints:
- allowed_values: [true,false]
customer_log_dir:
type: string
description: Log directory of customer
label: Custom log directory
default: /opt/customer/logs
java7_enabled:
type: string
description: Select enable java7 or not
default: true
label: Enable java 7
constraints:
- allowed_values: [true,false]
was_fixpack:
type: string
description: Was fixpack version, 2digits only
label: WAS fixpack version
default: '08'
java_fixpack:
type: string
description: java fixpack version
label: Java fixpack version
default: '7.1.3.10_0001'
sdk_64bit:
type: string
description: sdk feature, can select 32 bit or 64 bit
label: Enable 64bit SDK
default: true
constraints:
- allowed_values: [true,false]
was_profile_name:
type: string
description: Standalone profile name
label: WAS Standalone profile name
default: standalone01
was_cell_name:
type: string
description: Standalone cell name
label: WAS Standalone cell name
default: cell01
was_node_name:
type: string
description: Node name
label: WAS Standlone node name
default: standaloneNode01
was_server_name:
type: string
description: Server name
label: WAS Standalone server name
default: server01
parameter_groups:
- { label: 'Host Name Parameters', parameters: [was_vm_name] }
- { label: 'Image Parameters', parameters: [flavor, key_name, availability_zone, image_id, virtuser_password, root_password, sw_repo_root] }
- { label: 'Network Parameters', parameters: [network-id__for__patterns-service-dev-net, subnet_id_46fcd6d7-017e-437b-9921-d7fb9f76a7f2, public_network_id, security_group] }
- { label: 'Hidden Parameters', parameters: [salt_master_address, salt_api_token] }
- { label: 'WebSphere Parameters', parameters: [was_os_user, was_os_group, was_os_user_password, was_admin_username, was_admin_password, was_install_dir, was_profile_dir, im_install_dir, customer_log_dir_enabled, customer_log_dir, java7_enabled, was_fixpack, java_fixpack, sdk_64bit, was_profile_name, was_cell_name, was_node_name, was_server_name] }
resources:
wait_condition:
type: "AWS::CloudFormation::WaitCondition"
depends_on: was_standalone
properties:
Handle: { get_resource: wait_handle }
Timeout: 3600
wait_handle:
type: "AWS::CloudFormation::WaitConditionHandle"
############################
# WebSphere Server
############################
was_standalone:
type: OS::Nova::Server
properties:
networks:
- port: { get_resource: rhel-7_2-2015-12-13__to__patterns-service-dev-net__port }
name: { get_param: was_vm_name }
image: {get_param: image_id }
flavor: { get_param: flavor }
availability_zone: { get_param: availability_zone }
key_name: { get_param: key_name }
config_drive: 'True'
user_data_format: RAW
user_data: {get_resource: was_standalone_init}
rhel-7_2-2015-12-13__to__patterns-service-dev-net__port__floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id: { get_param: public_network_id }
port_id: { get_resource: rhel-7_2-2015-12-13__to__patterns-service-dev-net__port }
rhel-7_2-2015-12-13__to__patterns-service-dev-net__port:
type: OS::Neutron::Port
properties:
network_id: { get_param: network-id__for__patterns-service-dev-net }
replacement_policy: AUTO #TODO remove this if using HEAT version Icehouse!
fixed_ips:
- subnet: { get_param: subnet_id_46fcd6d7-017e-437b-9921-d7fb9f76a7f2 }
security_groups: [{ get_param: security_group }]
was_standalone_init:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: setup_ssh}
- config: {get_resource: update_etc_hosts}
- config: {get_resource: bootstrap_salt}
- config: {get_resource: assign_roles}
- config: {get_resource: create_pillar_file}
- config: {get_resource: run_orchestration}
- config: {get_resource: was_zeron_config}
update_etc_hosts:
type: "OS::Heat::SoftwareConfig"
properties:
config:
str_replace:
template: |
#!/usr/bin/env bash
set -e
sed -i '/$server_hostname/d' /etc/hosts
echo "$server_ip $server_hostname.$DOMAIN $server_hostname" >> /etc/hosts
params:
$server_hostname: { get_param: was_vm_name }
$server_ip: { get_attr: [rhel-7_2-2015-12-13__to__patterns-service-dev-net__port,fixed_ips, 0, ip_address] }
$DOMAIN: novalocal
assign_roles:
type: "OS::Heat::SoftwareConfig"
properties:
config:
str_replace:
template: |
#!/usr/bin/env bash
set -e
cat > /etc/salt/grains << EOF
environment:
$ENV
pattern:
$WORKLOAD_AUTOMATION
roles:
- $ROLES_1
- $ROLES_2
stack:
$STACK_ID
EOF
sleep 30
service salt-minion stop
sleep 15
service salt-minion start
params:
$ENV: base
$WORKLOAD_AUTOMATION: ibm_was
$ROLES_1: ibm_im_v1x_linux
$ROLES_2: ibm_websphere_applicationsvr_v855_linux_standalone
$STACK_ID: { get_param: "OS::stack_id" }
create_pillar_file:
type: "OS::Heat::SoftwareConfig"
properties:
config:
str_replace:
template: |
#!/usr/bin/env bash
set -e
totalMemory=`free -m | grep Mem | awk '{print $2}'`
if [ $totalMemory -le 1024 ]; then
initialHeapSize=512
maximumHeapSize=1024
elif [ $totalMemory -gt 1024 -a $totalMemory -le 2048 ]; then
initialHeapSize=1024
maximumHeapSize=2048
elif [ $totalMemory -gt 2048 -a $totalMemory -le 4096 ]; then
initialHeapSize=2048
maximumHeapSize=4096
elif [ $totalMemory -gt 4096 ]; then
initialHeapSize=4096
maximumHeapSize=8192
fi
cat << EOF > /tmp/pillar.yaml
ibm:
sw_repo_root: $SW_REPO_ROOT
im1x:
install_dir: $im_install_dir
wasv855:
users:
wasadmin:
gid: $was_os_group
home: /home/$was_os_user
name: $was_os_user
password: $was_os_password
paths:
# Install directory of websphere
install_dir: $was_install_dir
# Profile directory of websphere node
profile_dir: $was_profile_dir
temp_dir: /tmp/cbps
# Install directory of InstallationManager
im_install_dir: $im_install_dir
im_shared_dir: /opt/IBM/IMShared
settings:
java7:
enabled: $java7_enabled
was_fixpack: $was_fixpack
java_fixpack: $java_fixpack
customer_log_dir_enabled: $enabled_customer_log_dir
features:
com.ibm.sdk.6_32bit: false
com.ibm.sdk.6_64bit: $sdk_64bit
security:
admin_user: $was_admin_username
admin_user_password: $was_admin_password
# Jvm propertity
wsadmin:
set_jvm_properties:
standalone_jvmproperty:
profile_path: $was_profile_dir/$profile_name
node_name: $node_name
server_name: $server_name
initialHeapSize: $initialHeapSize
maximumHeapSize: $maximumHeapSize
set_process_execution:
profile_path: $was_profile_dir/$profile_name
runAsUser: $was_os_user
runAsGroup: $was_os_group
set_log_dir:
standalone_log_dir:
scope: server
log_dir: $customer_log_dir
profile_path: $was_profile_dir/$profile_name
cell_name: $cell_name
node_name: $node_name
server_name: $server_name
standalone_profile:
profile_name: $profile_name
cell: $cell_name
nodename: $node_name
servername: $server_name
EOF
params:
$SW_REPO_ROOT: {get_param: sw_repo_root }
$flavor: {get_param: flavor }
$profile_name: {get_param: was_profile_name}
$cell_name: {get_param: was_cell_name}
$node_name: {get_param: was_node_name}
$server_name: {get_param: was_server_name}
$was_os_user: {get_param: was_os_user}
$was_os_group: {get_param: was_os_group}
$was_os_password: {get_param: was_os_user_password}
$was_install_dir: {get_param: was_install_dir}
$im_install_dir: {get_param: im_install_dir}
$was_profile_dir: {get_param: was_profile_dir}
$java7_enabled: {get_param: java7_enabled}
$was_fixpack: {get_param: was_fixpack}
$java_fixpack: {get_param: java_fixpack}
#$sdk_32bit: {get_param: sdk_32bit}
$sdk_64bit: {get_param: sdk_64bit}
$was_admin_username: {get_param: was_admin_username}
$was_admin_password: {get_param: was_admin_password}
$customer_log_dir: {get_param: customer_log_dir}
$enabled_customer_log_dir: {get_param: customer_log_dir_enabled}
run_orchestration:
type: "OS::Heat::SoftwareConfig"
properties:
config:
str_replace:
template: |
#!/usr/bin/env bash
set -e
/opt/saltstack/embedded/bin/salt-wrapper.py orchestrate_heat dummyUser dummyPass \
--environment $ENV \
--automation $WORKLOAD_AUTOMATION \
--orchestration $ORCHESTRATION \
--wait_url '$WAIT_URL' \
--stack_id $STACK_ID \
--pillar_file /tmp/pillar.yaml \
--pillar stack_id=$STACK_ID \
--reactor_flask \
--salt_token $SALT_API_TOKEN
echo " /opt/saltstack/embedded/bin/salt-wrapper.py orchestrate_heat dummyUser dummyPass \
--environment $ENV \
--automation $WORKLOAD_AUTOMATION \
--orchestration $ORCHESTRATION \
--wait_url '$WAIT_URL' \
--stack_id $STACK_ID \
--pillar_file /tmp/pillar.yaml \
--pillar stack_id=$STACK_ID" \
--reactor_flask \
--salt_token $SALT_API_TOKEN >> /tmp/test
params:
$SALT_API_TOKEN: { get_param: salt_api_token}
$ENV: base
$WORKLOAD_AUTOMATION: ibm_was
$ORCHESTRATION: ibm_was_v855_linux_standalone_orchestration_zeron
$STACK_ID: { get_param: "OS::stack_id" }
$WAIT_URL: { get_resource: wait_handle }
was_zeron_config:
type: "OS::Heat::SoftwareConfig"
properties:
config:
str_replace:
params:
$PROFILEDIR: { get_param: was_profile_dir }
$PROFILE: { get_param: was_profile_name }
$SERVERNAME: { get_param: was_server_name }
template: |
#!/usr/bin/env bash
set -e
mkdir -p /etc/IBM/zeron/services/inventory/wasnd/node
cat > /etc/IBM/zeron/services/inventory/wasnd/node/inventory.json << EOF
{
"product_name" : "WebSphere Application Server",
"product_version" : "8.5.5.8",
"attributes" : {
}
}
EOF
mkdir -p /etc/IBM/zeron/services/logging/wasnd/node
cat > /etc/IBM/zeron/services/logging/wasnd/node/logging.json << EOF
[
{
"type" : "dir",
"name" : "WAS Nodeagent",
"path" : "$PROFILEDIR/$PROFILE/logs/$SERVERNAME/",
"pattern" : "*.log"
}
]
EOF
############################
# General Scripts
############################
bootstrap_salt:
type: "OS::Heat::SoftwareConfig"
properties:
config:
str_replace:
template: |
#!/usr/bin/env bash
set -e
if [ -f /etc/redhat-release ]; then
rpm -Uvh "http://159.122.222.80/sw_repo/salt/saltstack-latest-el$(rpm -qf --qf "%{VERSION}" /etc/redhat-release | cut -c1).x86_64.rpm"
elif [ -f /etc/lsb-release ]; then
curl "http://159.122.222.80/sw_repo/salt/saltstack-latest-trusty.x86_64.deb" -O
dpkg -i saltstack-latest-trusty.x86_64.deb
update-rc.d salt-minion start 80 2 3 4 5 .
fi
#chkconfig salt-minion on
mkdir -p /etc/salt/pki/minion
# retrieve saltMaster address from metadata if not passed
saltMaster=$SALT_MASTER
echo "master"$saltMaster >> /tmp/master
token=$SALT_API_TOKEN
echo "token"$token >> /tmp/master
if [ -z $saltMaster ] ; then
echo "no master" >> /tmp/master
saltMaster=$(curl -s http://159.122.222.80/sw_repo//metadata.yaml | awk '/salt_api_ip/ {print $2}')
fi
# Default log_level warning
cat > /etc/salt/minion << EOF
log_level: warning
master:
- $saltMaster
id: $STACK_ID-`hostname -s`
mine_functions:
network.interfaces: []
grains.items: []
mine_interval: 1
EOF
service salt-minion stop
sleep 10
service salt-minion start
sleep 30
wget http://159.122.222.80/sw_repo/salt/salt-wrapper.py -O /opt/saltstack/embedded/bin/salt-wrapper.py
/opt/saltstack/embedded/bin/salt-wrapper.py register dummyUser dummyPass -k $SALT_API_TOKEN
params:
$STACK_ID: { get_param: "OS::stack_id" }
$SALT_MASTER: { get_param: salt_master_address }
$SALT_API_TOKEN: { get_param: salt_api_token }
setup_ssh:
type: "OS::Heat::SoftwareConfig"
properties:
config:
str_replace:
template: |
#!/usr/bin/env bash
# add virtuser
set -e
useradd -m virtuser
mkdir -p /home/virtuser/.ssh
chown virtuser.virtuser /home/virtuser/.ssh
chmod 700 /home/virtuser/.ssh
# set the password for root and virtuser
echo virtuser:$USER_PWD | chpasswd
echo root:$ROOT_PWD | chpasswd
# setup sshd configuration
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sed -e "/PasswordAuthentication/d" /etc/ssh/sshd_config > /etc/ssh/sshd_config.tmp
cat /etc/ssh/sshd_config.tmp > /etc/ssh/sshd_config
rm -f /etc/ssh/sshd_config.tmp
echo $'\n' >> /etc/ssh/sshd_config
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
service sshd restart
params:
$USER_PWD: { get_param: virtuser_password}
$ROOT_PWD: { get_param: root_password}
outputs:
blueprint_url:
description: IBM WebSphere AppServer Console
value:
str_replace:
params:
$IPADDR: { get_attr: [rhel-7_2-2015-12-13__to__patterns-service-dev-net__port__floating_ip, floating_ip_address] }
template: https://$IPADDR:9043/ibm/console