1 # Hey Emacs, this is a -*- shell-script -*- !!!
3 ######################################################################
7 defconf CLUSTERFS_TYPE "gpfs" \
8 "<gpfs|?>" "type of cluster filesystem to use"
10 defconf CLUSTERFS_DEFAULT_MOUNTPOINT "/clusterfs" \
11 "<directory>" "mountpoint for default cluster filesystem"
13 defconf NODES "nas:0-3 rhel_base:4" \
14 "<nodes>" "list of node types to create, with associated IP offsets"
16 # a directory on the host which will be mounted via NFS onto the nodes
17 # as $NFS_MOUNTPOINT, giving a nice common area independent of the
18 # cluster filesystem. This is useful for compiles, RPMs, devel
19 # scripts etc you need to add this to your /etc/exports and run
20 # exportfs -av yourself on the virtualisation host
21 defconf NFSSHARE "@uto" \
22 "<mnt>" "NFS share to mount on each node"
24 defconf NFS_MOUNTPOINT "/home" \
25 "<dir>" "mount point for NFS share"
27 ######################################################################
29 # Directories and files
31 # these are the default autocluster config options
32 # please override with your own options in your own config file
34 defconf VIRTBASE /virtual \
35 "<path>" "virtual machine directory for this host"
37 # the name of the base RHEL install image that the nodes will be based on
38 # a kvm image called $VIRTBASE/$BASENAME.img will be created
39 # that will form the basis file for the images for each of the nodes
40 defconf BASENAME "ac-base" \
41 "<file>" "filename for cluster base image"
43 defconf BASE_PER_NODE_TYPE "no" \
44 "<yes|no>" "Use per-node-type base images"
46 defconf DISK_FOLLOW_SYMLINKS "no" \
47 "<yes|no>" "If disk images use symlinks then follow them to overwrite"
49 ######################################################################
53 defconf VIRSH "virsh -c qemu:///system" \
54 "<cmd>" "how to invoke virsh"
57 "<file>" "location of KVM executable"
59 defconf KVMLOG "/var/log/kvm" \
60 "<dir>" "directory for serial logs"
62 defconf NODE_TEMPLATE "$installdir/templates/node.xml" \
63 "<file>" "libvirt template for nodes"
65 defconf INSTALL_TEMPLATE "$installdir/templates/install.xml" \
66 "<file>" "libvirt template for initial install"
68 defconf INSTALL_KERNEL_OPTIONS "@uto" \
69 "<options>" "installer kernel command-line options"
71 defconf BOOT_TEMPLATE "$installdir/templates/bootbase.xml" \
72 "<file>" "libvirt template for \"bootbase\" command"
74 defconf BASE_TEMPLATES "$installdir/base" \
75 "<dir>" "directory containing base templates"
77 defconf BASE_FORMAT "qcow2" \
78 "<fmt>" "format to use for the qemu base images"
80 defconf SYSTEM_DISK_TYPE "virtio" \
81 "scsi|ide|virtio" "type of disks to use in nodes"
86 (scsi|iscsi) echo "sd" ;;
89 case "$RHEL_VERSION" in
92 (*) die "Unknown RHEL_VERSION in rhel_disk_prefix" ;;
95 (*) die "Unknown disk type \"$1\" in rhel_disk_prefix" ;;
100 defconf SYSTEM_DISK_PREFIX "@uto" \
101 "sd|hd|vd" "system disk device prefix"
103 defconf SYSTEM_DISK_CACHE "writeback" \
104 "default|none|writeback|writethrough" "system disk cache type"
106 defconf SYSTEM_DISK_FORMAT "qcow2" \
107 "qcow2|raw|reflink|mmclone|none" "system disk image format"
109 defconf SYSTEM_DISK_ACCESS_METHOD "@uto" \
110 "loopback|guestfish|guestmount" "how to setup up disk images"
112 system_disk_access_method_hook ()
114 if [ "$SYSTEM_DISK_ACCESS_METHOD" = "@uto" ] ; then
115 if [ "$SYSTEM_DISK_FORMAT" = "qcow2" ] ; then
116 if which guestmount >/dev/null 2>&1 ; then
117 SYSTEM_DISK_ACCESS_METHOD="guestmount"
118 elif which guestfish >/dev/null 2>&1 ; then
119 SYSTEM_DISK_ACCESS_METHOD="guestfish"
120 elif which qemu-nbd nbd-client >/dev/null 2>&1 ; then
121 SYSTEM_DISK_ACCESS_METHOD="loopback"
123 die "Can't determine SYSTEM_DISK_ACCESS_METHOD. Need guestfish or qemu-nbd + nbd-client."
126 SYSTEM_DISK_ACCESS_METHOD="loopback"
131 register_hook post_config_hooks system_disk_access_method_hook
133 system_disk_mounts ()
135 # We could call a function using call_func(). However, we want
136 # the options listed in the documentation for
137 # SYSTEM_DISK_ACCESS_METHOD, so they need to be hardcoded... so
138 # we might as well hardcode this function (for now).
139 case "$SYSTEM_DISK_ACCESS_METHOD" in
141 case "$RHEL_VERSION" in
142 (5.*) echo "/:32256" ;;
143 ([67].*) echo "/:1048576" ;;
144 (*) die "Unknown RHEL_VERSION in system_disk_mounts" ;;
147 (guestfish|guestmount) : ;;
148 (*) die "Unknown SYSTEM_DISK_ACCESS_METHOD in system_disk_mounts" ;;
152 defconf SYSTEM_DISK_MOUNTS "@uto" \
153 "<list>" "list of mountpoints and offsets/devices for mount_disk()"
155 ######################################################################
159 # what timezone to put the nodes in
160 # leave this empty to base the timezone on the zone that
162 defconf TIMEZONE "" \
163 "<tz>" "timezone for each node"
165 # how much disk space to use on each node
166 # note that it will only use what is actually occupied,
167 # so start this larger than you think you'll need
168 defconf DISKSIZE "20G" \
169 "<n>G" "maximum disk size for each node"
171 defconf ROOTSIZE 15000 \
172 "<n>" "size of root partition in MB"
174 defconf SWAPSIZE 2000 \
175 "<n>" "size of swap partition in MB"
179 case "$RHEL_VERSION" in
180 (5.*) echo "262144" ;;
181 ([67].*) echo "512000" ;;
182 (*) die "Unknown RHEL_VERSION in rhel_default_mem" ;;
187 "<n>" "memory allocated for each node"
189 defconf NICMODEL "e1000" \
190 "<module>" "choice of KVM network adapter"
192 defconf ROOTPASSWORD "password" \
193 "<string>" "initial root password for each node"
196 "<n>" "number of virtual CPUs per node"
198 # Some machines need "clocksource=jiffies"
199 defconf EXTRA_KERNEL_OPTIONS "" \
200 "<string>" "extra kernel options for nodes"
202 defconf HOSTNAME_HACKING_FUNCTION "" \
203 "<string>" "function to modify node hostnames, see the code for details"
205 defconf HOSTS_STATIC_ENTRIES "/dev/null" \
206 "<file>" "a file containing extra static entries to add to /etc/hosts"
208 ######################################################################
212 defconf DOMAIN "EXAMPLE.COM" \
213 "<dom>" "Windows(TM) domain name for each node"
215 defconf WORKGROUP "EXAMPLE" \
216 "<grp>" "Windows(TM) workgroup for node"
218 defconf NAMESERVER "@uto" \
219 "<ip>" "DNS server for each node"
221 defconf DNSSEARCH "$DOMAIN" \
222 "<dom>" "extra domains for DNS search list"
225 # * First network is private and contains the CTDB node addresses.
226 # * Items look like: net/bits,dev[,nat|bridge=host_iface][,gw=gateway_ip]
228 defconf NETWORKS "10.0.0.0/24,eth0,gw=10.0.0.1 10.0.1.0/24,eth1 10.0.2.0/24,eth2" \
229 "<list>" "description of IP networks"
231 defconf NETWORK_STACK "ipv4" \
232 "ipv4|dual|ipv6" "Configure IPv4/IPv6 stacks"
234 make_public_addresses()
236 local firstip="${1:-$[${FIRSTIP} + ${PUBLIC_IP_OFFSET}]}"
239 # By default the number of addresses on each public network is
240 # the same as the number of nodes
241 if [ -z "$num_addrs" ] ; then
245 if [ "$4" = "1" ] ; then
246 num_addrs=$(($num_addrs + 1))
249 for_each_node _count_ctdb_nodes
252 if [ $(( $firstip + $num_addrs - 1 )) -gt 254 ]; then
253 die "make_public_addresses: last octet > 254 - change PUBLIC_IP_OFFSET"
257 for n in $NETWORKS_PUBLIC ; do
258 local dev="${n#*,}" # Strip address, comma
259 dev="${dev%,*}" # Strip comma, interface
260 echo -ne "${n%.*}.${firstip},${num_addrs},${dev} "
265 networks_post_config_hook ()
267 [ -z "$IPBASE" -a -z "$IPNET0" -a -z "$IPNET1" -a -z "$IPNET2" ] || \
268 die "Configuration variables IPBASE, IPNET0/1/2 unsupported - please use NETWORKS"
270 # Convenience variables
272 NETWORK_PRIVATE="$1" ; shift
273 local t="${NETWORK_PRIVATE%%,*}"
274 NETWORK_PRIVATE_PREFIX="${t%.*}"
278 register_hook post_config_hooks networks_post_config_hook
280 defconf NETWORK_TEMPLATE "|network_template" \
281 "<file>" "libvirt template fragment for networks"
285 local netname dev ip ipv6 mac opts
286 while read netname dev ip ipv6 mac opts ; do
288 <interface type='network'>
289 <mac address='${mac}'/>
290 <model type='@@NICMODEL@@'/>
291 <source network='${netname}'/>
298 # the nodes will get IPs starting at this number
299 # the TSM server will get $FIRSTIP, then the first node will get
301 # so if the private network is 10.0.0.0/24,eth0 and FIRSTIP is 20 then
302 # you will get nodes like this:
303 # tsmserver 10.0.0.20
307 defconf FIRSTIP "20" \
308 "<n>" "final octet for the 1st IP of the cluster"
310 # Public addresses managed by CTDB.
311 defconf PUBLIC_IP_OFFSET 100 \
312 "<n>" "offset from FIRSTIP of public IP addresses"
314 defconf PUBLIC_ADDRESSES "|make_public_addresses" \
315 "<cmd>" "template for public address entry in nas.conf"
317 # a caching web proxy that can get to the install server from the
318 # nodes. If you don't have one on the local network then look in
319 # host_setup/etc/squid for an example setup you can install on the kvm
320 # host. The web proxy must cache large objects, and have room for
321 # several G of cache You can choose to have no web proxy at all, in
322 # which case set it to the empty string, and hope you have a fast
323 # network connection to the install server
324 defconf WEBPROXY "" \
325 "<url>" "URL of a caching web proxy"
327 defconf KVMHOST "10.0.0.1" \
328 "<ip>" "KVM host - provides things like NTP, iSCSI targets, ..."
330 defconf KDC_NAME "example-ad" \
331 "<name>" "prefix of the name of the KDC"
333 ######################################################################
339 # Uses: RHEL_VERSION, RHEL_ARCH
340 # Prints: a value for ISO
344 case "$RHEL_VERSION" in
345 (5.1) datever="20071017.0";;
346 (5.2) datever="20080430.0";;
347 (5.3) datever="20090106.0";;
348 (5.4) datever="20090819.0";;
349 (5.5) datever="20100322.0";;
350 (5.6) datever="20110106.0";;
351 (5.7) datever="20110711.5";;
352 (5.8) datever="20120202.0";;
353 (6.0) datever="20100922.1";;
354 (6.1) datever="20110510.1";;
355 (6.2) datever="20111117.0";;
356 (6.3) datever="20120613.2";;
357 (6.4) datever="20130130.0";;
358 (6.5) datever="20131111.0";;
359 (6.6) datever="20140926.0";;
360 (7.0) datever="20140507.0";;
361 (*) die "Unknown RHEL_VERSION in rhel_print_iso" ;;
364 case "$RHEL_VERSION" in
365 (5.*) echo "RHEL${RHEL_VERSION}-Server-${datever}-${RHEL_ARCH}-DVD.iso" ;;
366 (6.[0-5]) echo "RHEL${RHEL_VERSION}-${datever}-Server-${RHEL_ARCH}-DVD1.iso" ;;
367 ([67].*) echo "RHEL-${RHEL_VERSION}-${datever}-Server-${RHEL_ARCH}-dvd1.iso" ;;
371 # yum repo infrastructure
372 _YUM_TEMPLATE="$installdir/templates/RHEL.repo" # Private - used below!
373 rhel_gen_yum_repos ()
375 echo "# Generated by autocluster."
378 # Repo IDs can not contain slashes, so replace slashes with dashes.
382 baseurl=@@INSTALL_SERVER@@/${repo}
398 if t=$(which qemu-kvm 2>/dev/null) ; then
400 elif t=$(which kvm 2>/dev/null) ; then
402 elif [ -x "/usr/libexec/qemu-kvm" ] ; then
403 echo "/usr/libexec/qemu-kvm"
405 die "Could not find KVM executable"
410 rhel_get_install_kernel_options ()
412 case "$RHEL_VERSION" in
413 (7.*) echo "ks=hd:LABEL=KICKSTART inst.stage2=hd:LABEL=RHEL-${RHEL_VERSION}\\\\x20Server.${RHEL_ARCH}" ;;
414 (*) echo "ks=floppy" ;;
418 rhel_get_install_ks_device_xml ()
420 if [ ${RHEL_VERSION%%.*} -le 6 ] ; then
422 <disk type='file' device='floppy'>
423 <source file='@@PWD@@/tmp/floppy.img'/>
430 <disk type='file' device='disk'>
431 <source file='@@PWD@@/tmp/floppy.img'/>
432 <target dev='@@SYSTEM_DISK_PREFIX@@b' bus='@@SYSTEM_DISK_TYPE@@'/>
433 <driver name='qemu' type='raw'/>
439 rhel_get_multipath_magic ()
441 if [ ${RHEL_VERSION%%.*} -le 6 ] ; then
444 getuid_callout "$SHARED_DISK_MULTIPATH_CALLOUT"
449 rhel_post_config_hook ()
451 if [ "$ISO" = "@uto" ] ; then
452 ISO=$(rhel_print_iso) || exit $?
455 if [ "$SYSTEM_DISK_MOUNTS" = "@uto" ] ; then
456 SYSTEM_DISK_MOUNTS=$(system_disk_mounts) || exit $?
459 if [ "$MEM" = "@uto" ] ; then
460 MEM=$(rhel_default_mem) || exit $?
463 if [ "$SYSTEM_DISK_PREFIX" = "@uto" ] ; then
464 SYSTEM_DISK_PREFIX=$(rhel_disk_prefix $SYSTEM_DISK_TYPE) || exit $?
467 if [ "$KVM" = "@uto" ] ; then
468 KVM=$(get_kvm_path) || exit $?
471 if [ "$INSTALL_KERNEL_OPTIONS" = "@uto" ] ; then
472 INSTALL_KERNEL_OPTIONS=$(rhel_get_install_kernel_options) || exit $?
475 if [ "$INSTALL_KS_DEVICE_TEMPLATE" = "@uto" ] ; then
476 INSTALL_KS_DEVICE_TEMPLATE=$(rhel_get_install_ks_device_xml) || exit $?
479 if [ "$RHEL_MULTIPATH_MAGIC" = "@uto" ] ; then
480 RHEL_MULTIPATH_MAGIC=$(rhel_get_multipath_magic) || exit $?
483 if [ "$NAMESERVER" = "@uto" ] ; then
484 NAMESERVER="$KVMHOST"
487 if [ "$INSTALL_SERVER" = "@uto" ] ; then
488 INSTALL_SERVER="http://${KVMHOST}/mediasets"
491 if [ "$NFSSHARE" = "@uto" ] ; then
492 NFSSHARE="10.0.0.1:/home"
496 register_hook post_config_hooks rhel_post_config_hook
498 defconf RHEL_ARCH "x86_64" \
499 "<arch>" "The RHEL operating system architecture to configure"
501 defconf RHEL_VERSION "6.2" \
502 "<version>" "version of Red Hat Enterprise Linux to configure"
504 defconf RHEL_MULTIPATH_MAGIC "@uto"
506 defconf ISO_DIR "/virtual/ISO" \
507 "<dir>" "directory for ISO images, prepended to $ISO if not absolute"
510 "<file>" "ISO image for base image creation"
512 # the install server where we will get local packages from
513 defconf INSTALL_SERVER "@uto" \
514 "<url>" "URL of install server"
516 defconf CONFIG_EXTRA_PACKAGES "" \
517 "<packages>" "list of extra packages to install at configuration time"
519 # the yum repositories to use. Choose the one appropriate for the
520 # system you are installing
521 defconf YUM_TEMPLATE "$_YUM_TEMPLATE" \
522 "<file>" "location of template for yum repositories"
524 defconf INSTALL_KS_DEVICE_TEMPLATE "@uto"
526 ##############################
528 defconf CREATE_BASE_TIMEOUT 3600 \
529 "<seconds>" "time to wait for base image install before aborting"
531 ##############################
533 # Authentication method
534 defconf AUTH_METHOD "files" \
535 "files|winbind" "authentication method"
537 ##############################