summaryrefslogtreecommitdiffstats
path: root/config.d/00base.defconf
blob: 5cb7d1cd6067e745041fa7541b37e2edcc05a6c3 (plain)
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
# Hey Emacs, this is a -*- shell-script -*- !!!

######################################################################

# Cluster

defconf NODES "rhel_base:0-3" \
	"<nodes>" "list of node types to create, with associated IP offsets"

defconf NUMNODES "" \
	"<n>" "number of nodes to build, not including TSM server"

# a directory on the host which will be mounted via NFS onto the nodes
# as $NFS_MOUNTPOINT, giving a nice common area independent of the
# cluster filesystem.  This is useful for compiles, RPMs, devel
# scripts etc you need to add this to your /etc/exports and run
# exportfs -av yourself on the virtualisation host
defconf NFSSHARE "10.0.0.1:/home" \
	"<mnt>" "NFS share to mount on each node"

defconf NFS_MOUNTPOINT "/home" \
	"<dir>" "mount point for NFS share"

######################################################################

# Directories and files

# these are the default autocluster config options
# please override with your own options in your own config file

defconf VIRTBASE /virtual \
	"<path>" "virtual machine directory for this host"

# the name of the base RHEL install image that the nodes will be based on
# a kvm image called $VIRTBASE/$BASENAME.img will be created
# that will form the basis file for the images for each of the nodes
defconf BASENAME "ac-base" \
	"<file>" "filename for cluster base image"

defconf BASE_PER_NODE_TYPE "no" \
	"<yes|no>" "Use per-node-type base images"

######################################################################

# Virtualisation

defconf VIRSH "virsh -c qemu:///system" \
	"<cmd>" "how to invoke virsh"

# the kvm binary to use - should be a very recent version
# I am using a git snapshot from http://kvm.qumranet.com/kvmwiki/Code
defconf KVM "/usr/bin/qemu-kvm" \
	"<file>"  "location of KVM executable"

defconf KVMLOG "/var/log/kvm" \
	"<dir>" "directory for serial logs"

defconf NODE_TEMPLATE "$installdir/templates/node.xml" \
	"<file>" "libvirt template for nodes"

defconf INSTALL_TEMPLATE "$installdir/templates/install.xml" \
	"<file>" "libvirt template for initial install"

defconf BOOT_TEMPLATE "$installdir/templates/bootbase.xml" \
	"<file>" "libvirt template for \"bootbase\" command"

defconf BASE_TEMPLATES "$installdir/base" \
	"<dir>" "directory containing base templates"

defconf BASE_FORMAT "qcow2" \
	"<fmt>" "format to use for the qemu base images"

defconf SYSTEM_DISK_TYPE "ide" \
	"scsi|ide|virtio" "type of disks to use in nodes"

rhel_disk_prefix ()
{
    case "$1" in
	(scsi|iscsi) echo "sd" ;;
	(virtio)     echo "vd" ;;
	ide)
	    case "$RHEL_VERSION" in
		(5.*) echo "hd" ;;
		(6.*) echo "sd" ;;
		(*) die "Unknown RHEL_VERSION in rhel_disk_prefix" ;;
	    esac
	    ;;
	(*) die "Unknown disk type \"$1\" in rhel_disk_prefix" ;;
	    
    esac
}

defconf SYSTEM_DISK_PREFIX "@uto" \
	"sd|hd|vd" "system disk device prefix"

defconf SYSTEM_DISK_CACHE "writeback" \
	"default|none|writeback|writethrough" "system disk cache type"

defconf SYSTEM_DISK_FORMAT "qcow2" \
	"qcow2|raw|reflink|mmclone|none" "system disk image format"

defconf SYSTEM_DISK_ACCESS_METHOD "@uto" \
	"loopback|guestfish|guestmount" "how to setup up disk images"

system_disk_access_method_hook ()
{
    if [ "$SYSTEM_DISK_ACCESS_METHOD" = "@uto" ] ; then
	if [ "$SYSTEM_DISK_FORMAT" = "qcow2" ] ; then
	    if which guestmount >/dev/null 2>&1 ; then
		SYSTEM_DISK_ACCESS_METHOD="guestmount"
	    elif which guestfish >/dev/null 2>&1 ; then
		SYSTEM_DISK_ACCESS_METHOD="guestfish"
	    elif which qemu-nbd nbd-client >/dev/null 2>&1 ; then
		SYSTEM_DISK_ACCESS_METHOD="loopback"
		ISO=$(rhel_print_iso)
	    else
		die "Can't determine SYSTEM_DISK_ACCESS_METHOD.  Need guestfish or qemu-nbd + nbd-client."
	    fi
	else
	    SYSTEM_DISK_ACCESS_METHOD="loopback"
	fi
    fi
}

register_hook post_config_hooks system_disk_access_method_hook

system_disk_mounts ()
{
    # We could call a function using call_func().  However, we want
    # the options listed in the documentation for
    # SYSTEM_DISK_ACCESS_METHOD, so they need to be hardcoded...  so
    # we might as well hardcode this function (for now).
    case "$SYSTEM_DISK_ACCESS_METHOD" in
	loopback)
	    case "$RHEL_VERSION" in
		(5.*) echo "/:32256" ;;
		(6.*) echo "/:1048576" ;;
		(*) die "Unknown RHEL_VERSION in system_disk_mounts" ;;
	    esac
	    ;;
	(guestfish|guestmount) echo "/:/dev/vda1" ;;
	(*) die "Unknown SYSTEM_DISK_ACCESS_METHOD in system_disk_mounts" ;;
    esac
}

defconf SYSTEM_DISK_MOUNTS "@uto" \
	"<list>" "list of mountpoints and offsets/devices for mount_disk()"

######################################################################

# Node

# what timezone to put the nodes in
# leave this empty to base the timezone on the zone that
# this host is in
defconf TIMEZONE "" \
	"<tz>" "timezone for each node"

defconf KEYBOARD "us" \
	"<kbd>" "keyboard layout for each node"

# how much disk space to use on each node
# note that it will only use what is actually occupied,
# so start this larger than you think you'll need
defconf DISKSIZE "20G" \
	"<n>G" "maximum disk size for each node"

defconf ROOTSIZE 15000 \
	"<n>" "size of root partition in MB"

defconf SWAPSIZE 2000 \
	"<n>" "size of swap partition in MB"

rhel_default_mem ()
{
    case "$RHEL_VERSION" in
	(5.*) echo "262144" ;;
	(6.*) echo "512000" ;;
	(*) die "Unknown RHEL_VERSION in rhel_default_mem" ;;
    esac
}

defconf MEM "@uto" \
	"<n>" "memory allocated for each node"

defconf NICMODEL "e1000" \
	"<module>" "choice of KVM network adapter"

defconf ROOTPASSWORD "password" \
	"<string>" "initial root password for each node"

defconf KS_LANGUAGE "${LANG:-en_US.UTF-8}" \
	"<locale>" "locale for installer to use"

defconf NUMCPUS 2 \
	"<n>" "number of virtual CPUs per node"

# Some machines need "clocksource=jiffies"
defconf	EXTRA_KERNEL_OPTIONS "" \
	"<string>" "extra kernel options for nodes"

defconf HOSTNAME_HACKING_FUNCTION "" \
	"<string>" "function to modify node hostnames, see the code for details"

defconf HOSTS_STATIC_ENTRIES "/dev/null" \
	"<file>" "a file containing extra static entries to add to /etc/hosts"

######################################################################

# Networking

defconf DOMAIN "AC1.COM" \
	"<dom>" "Windows(TM) domain name for each node"

defconf WORKGROUP "AC1" \
	"<grp>" "Windows(TM) workgroup for node"

# DNS name server. Usually set this to the
# kvm host, then setup DNS on the kvm host to direct 
# queries for the windows domain name to the w2003 server
defconf NAMESERVER "10.0.0.1" \
	"<ip>" "DNS server for each node"

defconf DNSSEARCH "$DOMAIN" \
	"<dom>" "extra domains for DNS search list"

# set the first two octets of the IPs we will use
# the 3rd and 4th octets are controlled by the node setup scripts
defconf IPBASE "10.0" \
	"<n>.<n>" "first 2 octets of IP for each node"

defconf IPNET0 "0" \
	"<n>" "3rd octet of IP for each node for network 0"

defconf IPNET1 "1" \
	"<n>" "3rd octet of IP for each node for network 1"

defconf IPNET2 "2" \
	"<n>" "3rd octet of IP for each node for network 2"


# the nodes will get IPs starting at this number 
# the TSM server will get $FIRSTIP, then the first node will get
# the next IP etc
# so if IPBASE is 10.0, IPNET0 is 0 and FIRSTIP is 20 then
# you will get nodes like this:
#     tsmserver   10.0.0.20
#     1st node    10.0.0.21
#     2nd node    10.0.0.22
# etc etc
defconf FIRSTIP "20" \
	"<n>" "final octet for the 1st IP of the cluster"

# Public addresses managed by CTDB.
defconf PUBLIC_IP_OFFSET 100 \
	"<n>" "offset from FIRSTIP of public IP addresses"

defconf PUBLIC_ADDRESSES "|make_public_addresses" \
	"<cmd>" "template for public address entry in gpfs-nas.conf"

# a caching web proxy that can get to the install server from the
# nodes. If you don't have one on the local network then look in
# host_setup/etc/squid for an example setup you can install on the kvm
# host. The web proxy must cache large objects, and have room for
# several G of cache You can choose to have no web proxy at all, in
# which case set it to the empty string, and hope you have a fast
# network connection to the install server
defconf WEBPROXY "http://10.0.0.1:3128/" \
	"<url>" "URL of a caching web proxy"

defconf GATEWAY "10.0.0.1" \
	"<ip>" "IP gateway for cluster hosts, usually KVM host"

defconf CIFSNAME "Samba01" \
	"<name>" "name of the system in CIFS protocol"

defconf KDC_NAME "ac1-ad" \
	"<name>" "prefix of the name of the KDC"

######################################################################

# RHEL

rhel_print_iso ()
{
    # Uses: RHEL_VERSION, RHEL_ARCH
    # Prints: a value for ISO

    local datever

    case "$RHEL_VERSION" in
	(5.1) datever="20071017.0";;
	(5.2) datever="20080430.0";;
	(5.3) datever="20090106.0";;
	(5.4) datever="20090819.0";;
	(5.5) datever="20100322.0";;
	(5.6) datever="20110106.0";;
	(5.7) datever="20110711.5";;
	(6.0) datever="20100922.1";;
	(6.1) datever="20110510.1";;
	(6.2) datever="20111117.0";;
	(*) die "Unknown RHEL_VERSION in rhel_print_iso" ;;
    esac

    case "$RHEL_VERSION" in
	(5.*) echo "RHEL${RHEL_VERSION}-Server-${datever}-${RHEL_ARCH}-DVD.iso"  ;;
	(6.*) echo "RHEL${RHEL_VERSION}-${datever}-Server-${RHEL_ARCH}-DVD1.iso" ;;
    esac
}

rhel_package_list ()
{
    cat "$installdir/templates/RHEL${RHEL_VERSION%%.*}.packages"
}

# yum repo infrastructure
_YUM_TEMPLATE="$installdir/templates/RHEL.repo" # Private - used below!
rhel_gen_yum_repos ()
{
    echo "# Generated by autocluster."

    for repo ; do
cat <<EOF
[${repo}]
name=${repo}
baseurl=@@INSTALL_SERVER@@/${repo}
enabled=1
gpgcheck=0

EOF
    done

cat <<EOF
@@@_YUM_TEMPLATE@@@
EOF
}

rhel_post_config_hook ()
{
    if [ "$ISO" = "@uto" ] ; then
	ISO=$(rhel_print_iso)
    fi

    if [ "$SYSTEM_DISK_MOUNTS" = "@uto" ] ; then
	SYSTEM_DISK_MOUNTS=$(system_disk_mounts)
    fi

    if [ "$MEM" = "@uto" ] ; then
	MEM=$(rhel_default_mem)
    fi

    if [ "$SYSTEM_DISK_PREFIX" = "@uto" ] ; then
	SYSTEM_DISK_PREFIX=$(rhel_disk_prefix $SYSTEM_DISK_TYPE)
    fi
}

register_hook post_config_hooks rhel_post_config_hook

defconf RHEL_ARCH "x86_64" \
	"<arch>" "The RHEL operating system architecture to configure"

defconf RHEL_VERSION "5.4" \
	"<version>" "version of Red Hat Enterprise Linux to configure"

defconf RHEL_PACKAGES "|rhel_package_list"

defconf ISO_DIR "/virtual/ISO" \
	"<dir>" "directory for ISO images, prepended to $ISO if not absolute"

defconf ISO "@uto" \
	"<file>" "ISO image for base image creation"

# which template kickstart file to use. There are separate templates
# for each version of SoFS
defconf KICKSTART "$installdir/templates/kickstart-SoFS.cfg" \
	"<file>" "choice of kickstart file"

# the install server where we will get local packages from
defconf INSTALL_SERVER "http://10.0.0.1/mediasets" \
        "<url>" "URL of install server"

# the yum repositories to use. Choose the one appropriate for the
# system you are installing
defconf YUM_TEMPLATE "$_YUM_TEMPLATE" \
	"<file>" "location of template for yum repositories"

# any extra packages to install. List one on each line. To force a package
# not to be installed, list it with a leading - 
defconf EXTRA_PACKAGES '
emacs
-xorg-x11-drivers
-xorg-x11-server-Xorg
' \
	"<list>" "extra packages for kickstart to install"

defconf EXTRA_CHKCONFIGS "" \
	"<chkconfigs>" "extra chkconfig commands to run in post-install"

defconf INSTALLKEY "--skip" \
	"<key>" "RHEL install key"

defconf STANDARD_POSTINSTALL "$installdir/templates/basic-postinstall.sh" \
	"<file>" "standard kickstart postinstall script - change with care"

defconf POSTINSTALL_TEMPLATE "" \
	"<file>" "extra script to be incorporated into kickstart post-install"

defconf KS_KERNEL_OPTS "rhgb console=tty1 console=ttyS0,19200 nodmraid nompath" \
	"<opts>" "options passed by kickstart to the kernel"

defconf KS_DONE_MESSAGE "you may safely reboot your system|System halted." \
	"<string>" "string indicating kickstart install is complete"

##############################

defconf CREATE_BASE_TIMEOUT 3600 \
	"<seconds>" "time to wait for base image install before aborting" 

##############################

# Note that this is only for RHEL packages available in Kickstart.
# This is not for packages installed from a local repository!
_EXTRA_RHEL_PACKAGES=""
add_extra_package ()
{

    _EXTRA_RHEL_PACKAGES="${_EXTRA_RHEL_PACKAGES}
$*"
}

add_extra_chkconfig ()
{
    local package="$1"
    local state="$2"

    EXTRA_CHKCONFIGS="${EXTRA_CHKCONFIGS}${EXTRA_CHKCONFIGS:+ }${package}:${state}"
}

##############################

register_hook hack_nodes_functions hack_nodes_rhel_base

hack_nodes_rhel_base ()
{
    local node_count_rhel_base=0
    hack_filter ()
    {
	case "$node_type" in
	    rhel_base)
		node_count_rhel_base=$(($node_count_rhel_base + 1))
		name="${CLUSTER}base${node_count_rhel_base}"
		ctdb_node=1
	    esac
    }
    hack_all_nodes_with hack_filter
}

create_node_rhel_base ()
{
    local ip_offset="$1"
    local name="$2"
    local ctdb_node="$3"

    echo "Creating RHEL base node $name"
    create_node_COMMON "$name" "$ip_offset" "$type"
}

has_public_addresses_rhel_base ()
{
    true
}

##############################

# Authentication method
defconf AUTH_METHOD "files" \
    "files|winbind" "authentication method"

##############################