diff options
author | 2008-08-22 00:30:45 -0400 | |
---|---|---|
committer | 2008-08-22 00:30:45 -0400 | |
commit | 9e33f2130a14a4510f197a40f26368ba892a109e (patch) | |
tree | 7a17106c571bfc06c3a0b3da6b25178311a3ab2c | |
parent | replaced by r2 (diff) | |
download | clustering-livecd-9e33f2130a14a4510f197a40f26368ba892a109e.tar.gz clustering-livecd-9e33f2130a14a4510f197a40f26368ba892a109e.tar.bz2 clustering-livecd-9e33f2130a14a4510f197a40f26368ba892a109e.zip |
Pull out ssh configuration and place it into a stand-alone scritp
Re-arrange nfs exportfs generation into function calls (cleaner and more versatile)
-rw-r--r-- | overlay/sys-cluster/beowulf-head/Manifest | 5 | ||||
-rw-r--r-- | overlay/sys-cluster/beowulf-head/beowulf-head-0.1.ebuild | 55 | ||||
-rw-r--r-- | overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh | 31 |
3 files changed, 67 insertions, 24 deletions
diff --git a/overlay/sys-cluster/beowulf-head/Manifest b/overlay/sys-cluster/beowulf-head/Manifest index b995adb..3de04f9 100644 --- a/overlay/sys-cluster/beowulf-head/Manifest +++ b/overlay/sys-cluster/beowulf-head/Manifest @@ -2,8 +2,9 @@ AUX c3-add 686 RMD160 ede4fc8bb832046607e79f831942a3d0708cbcab SHA1 cb496f813706 AUX c3-del 104 RMD160 18b49c1a929b0fc08912692f41ec8df1313c940d SHA1 b7d66c89d64fcb7a32a8d62cb147dcaf2994c3e7 SHA256 f4e3e9431c40b50f1596816eaa4d1f760ab840ae555d5fa2a76a7672d0432dfa AUX cluster.conf 2621 RMD160 b26b26c4482be2d921fa8b1ddb99f42ea3120bf9 SHA1 3d1a2926c977472e2ace5a3b831681e4def390ad SHA256 56fe9f2e51f6a27467721b850fdf1e68ad3d3df484bfa096e8841cae5a044d54 AUX dnsmasq-2.4-conf 1552 RMD160 08dae8ff1cd345acedb4cbbb819f8ccf35211b8b SHA1 e770ba62ca66b61cd84409bbb22433b1dfcf9ff3 SHA256 f2b63d6fc8558c84e79b5f172c4057354bdfe000aae19f8aa1857655259a6b7f -AUX node-manager 2101 RMD160 77c7f5281a0139b044f6efe934fbeb0d0682a11c SHA1 a6e03aa59573e790004bcbbf42e9bd5239722c56 SHA256 8e0dcce75e9eeef1029b81c2a935d68c472485b7ff41ac6e90c802195d8dd300 +AUX node-manager 2119 RMD160 9cb7ffdd91c0bc699abf59b87bf5894157001ad1 SHA1 cd0c66248bd3701269418b64bf66afd6b453efb0 SHA256 35925b1ad4fd29e9a41437344023a81ffa7e2348aff9afc1f710a9521579b856 +AUX setup-pwdless-ssh 819 RMD160 418271742cb1046efebd2ad4ef2d3e99845142ba SHA1 d06002173fec53bb46f6f5ff6dd30a0ed2e74bfb SHA256 6a6ac28a8c5c9e32d5544ea0c18afe43fa96456c4a52d5f4849cd5f4527aa766 AUX torque-add 629 RMD160 79040160b992cfefde964fc6511022e029c1b58a SHA1 324d4b0cb5071aaf3a6c62d01bb613cdf8ecf901 SHA256 5d3d4c3ab35923632b81eaf48d64d6cba1060d0a1887fbc85e8adf10b7fc52c9 AUX torque-del 132 RMD160 bc1e0a9ccc6ce20630003f7372d62bdb705b9187 SHA1 c735f03fb6715ab601cb84f4fbc92be78ce43575 SHA256 c455764846f192930625721958532d3cee64aa75d9d83a37b67544e4c7bdee64 -EBUILD beowulf-head-0.1.ebuild 7466 RMD160 ccce8655a1ac50b26fd7b6399fe8c869f72c7b41 SHA1 56f905994cad453a7c5c73657d306e7057379b84 SHA256 14d3301f82159232ef471ce3de20cab5af51dec363ce830a9f632d9f210d75ab +EBUILD beowulf-head-0.1.ebuild 7579 RMD160 e79ba991395ae8817f1f6c669315b5511ba4f236 SHA1 264daab5b6dda5efa9e1b6a87371a6f4f85d945b SHA256 67d6cc0d23c3d5aa814b2360d207858194959bfbea719100e336ee381c13f944 MISC ChangeLog 101 RMD160 d735719ccc09237e68e4e984eb5451000b06c382 SHA1 79098d1e8ae451f0430d363da6b717966ade6e78 SHA256 8dd010e2772026c4a6b86839842931b99c85c44a5e9f380864cc275b55587ac2 diff --git a/overlay/sys-cluster/beowulf-head/beowulf-head-0.1.ebuild b/overlay/sys-cluster/beowulf-head/beowulf-head-0.1.ebuild index e09e0c6..9feedad 100644 --- a/overlay/sys-cluster/beowulf-head/beowulf-head-0.1.ebuild +++ b/overlay/sys-cluster/beowulf-head/beowulf-head-0.1.ebuild @@ -147,38 +147,40 @@ pxe_conf() ln -s "${ROOT}/usr/lib/syslinux/pxelinux.0" "${TFTPROOT}/pxelinux.0" } -nfs_root_conf() +# In: PATH_TO_EXPORT ro/rw fsid +# out: /etc/exports (and ${NFSROOT}/etc/autofs/auto.nfs +add_exports() { - [ -d ${NFSROOT} ] || die "${NFSROOT} is missing! Either create your own of find one ;)" - if [ ! -f ${NFSROOT}/boot/kernel ]; then - ewarn "Couldn't find ${NFSROOT}/boot/kernel !" - ewarn "This is what we built the config files to expect." - ewarn "You might have to perform" + local I="$1" + local MODE=$2 + local fsid=$3 + + if use nonfsv4 ; then + echo "${I} $NETADDR/$SUBNET($MODE,$NFSEPORTOPTS,fsid=$fsid)" >> ${ROOT}/etc/exports + else + mkdir -p ${NFSROOT}/${I} + mount -o bind ${I} ${NFSROOT}/${I} fi + use autofs && echo "${I/\/} -$MODE,$NFSMOUNTOPTS $CLUSTER_ETH_Ir:${I}" >> ${NFSROOT}/etc/autofs/auto.nfs +} + +nfs_exports_conf() +{ + local fsid=0 echo "${NFSROOT} $NETADDR/$SUBNET(ro,$NFSEPORTOPTS,fsid=0)" > ${ROOT}/etc/exports - # Yes, this could be looped on RO and RW...but that wouldn't be more redable + # Yes, this could be looped on RO and RW...but that wouldn't be any more redable than it already isn't ;) for I in $ROEXPORTS do - if use nonfsv4 ; then - echo "${I} $NETADDR/$SUBNET(ro,$NFSEPORTOPTS)" >> ${ROOT}/etc/exports - else - mkdir -p ${NFSROOT}/${I} - mount -o bind ${I} ${NFSROOT}/${I} - fi - use autofs && echo "${I/\/} -ro,$NFSMOUNTOPTS $CLUSTER_ETH_Ir:${I}" >> ${NFSROOT}/etc/autofs/auto.nfs + ((fsid++)) + add_exports "$I" "ro" $fsid done for I in $RWEXPORTS do - if use nonfsv4 ; then - echo "${I} $NETADDR/$SUBNET(rw,$NFSEPORTOPTS)" >> ${ROOT}/etc/exports - else - mkdir -p ${NFSROOT}/${I} - mount -o bind ${I} ${NFSROOT}/${I} - fi - use autofs && echo "${I/\/} -rw,$NFSMOUNTOPTS $CLUSTER_ETH_Ir:${I}" >> ${NFSROOT}/etc/autofs/auto.nfs + ((fsid++)) + add_exports "$I" "rw" $fsid done } @@ -229,6 +231,7 @@ src_install(){ doins ${FILESDIR}/${CONFIG_FILE} dosbin ${S}/node-manager + dosbin ${FILESDIR}/setup-pwdless-ssh # add and delnode are derived from the dnsmasq add/del/old directives # passed onto the node-manager script...don't change arbritrarily @@ -245,11 +248,19 @@ src_install(){ pkg_config() { parse_config "${CONFPATH}/${CONFIG_FILE}" + + [ -d ${NFSROOT} ] || die "${NFSROOT} is missing! Either create your own of find one ;)" + if [ ! -f ${NFSROOT}/boot/kernel ]; then + ewarn "Couldn't find ${NFSROOT}/boot/kernel !" + ewarn "This is what we built the config files to expect." + ewarn "You might have to perform a catalyst build to generate the NFS root filesystem." + fi + get_ip_config dnsmasq_conf resolv_conf pxe_conf - nfs_root_conf + nfs_exports_conf use pbs && TORQUED="pbs_server pbs_sched" for I in dnsmasq netmount nfs $TORQUED diff --git a/overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh b/overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh new file mode 100644 index 0000000..082a20f --- /dev/null +++ b/overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh @@ -0,0 +1,31 @@ +#!/bin/bash +pushd $PWD + +KEY_NAME="node_dsa" + +echo "Setting up passwordless ssh for $USER between master and the nodes" +echo "The key is stored as $HOME/.ssh/$KEY_NAME(.pub)" + +mkdir -p $HOME/.ssh/ +cd $HOME/.ssh/ + +ssh-keygen -t dsa -b 1024 -f $KEY_NAME -N "" +# since this is an nfs-mounted $HOME, we simply add the key to self +# Usually, this would have to be replicated to all remote hosts +# if $HOME wasn't shared +cat $KEY_NAME.pub >> $HOME/.ssh/authorized_keys + +chmod 600 $HOME/.ssh/* +chmod 700 $HOME/.ssh + +cat >> $HOME/.ssh/config <<-EOF +# Auto-generated by $0 to ease the use of passwordless logins for all users +# Although this approach is questionnable, (Security on Host ...), it works +Host *.gentoo.local node* +IdentityFile $HOME/.ssh/$KEY_NAME +StrictHostKeyChecking no +CheckHostIP no +Compression no +EOF + +popd |