diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3154e996e5..fa1e2d30f8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,20 @@ CHANGELOG ========= +0.0.7 +===== + +* feature:``cfncluster``: Added option to encrypt ephemeral drives with in-memory keys +* feature:``cfncluster``: Detect all ephemeral drives, stripe and mount as /scratch +* feature:``cfncluster``: Support for placement groups +* feature:``cfncluster``: Support for cluster placement logic. Can either be cluster or compute. +* feature:``cfncluster``: Added option to provides arguments to pre/post install scripts +* feature:``cfncluster``: Added DKMS support for Lustre filesystems - http://zfsonlinux.org/lustre.html +* bugfix:``cli``: Added missing support from SSH from CIDR range +* bugfix:``cfncluster``: Fixed Ganglia setup for ComputeFleet +* updates:``SGE``: Updated to 8.1.7 - https://arc.liv.ac.uk/trac/SGE +* updates:``Openlava``: Updated to latest Git for Openlava 2.2 - https://github.com/openlava/openlava + 0.0.6 ===== diff --git a/amis.txt b/amis.txt index 806514f64d..3d3a4e5586 100644 --- a/amis.txt +++ b/amis.txt @@ -1,4 +1,4 @@ -us-west-2 ami-e581fcd5 -us-east-1 ami-745ea11c -eu-west-1 ami-e3458c94 -ap-northeast-1 ami-2d41092c +us-west-2 ami-7dcab74d +us-east-1 ami-2c07f944 +eu-west-1 ami-a1a169d6 +ap-northeast-1 ami-b3c78fb2 diff --git a/bootstrap/Makefile b/bootstrap/Makefile index 2956fa1a9d..af46e95a12 100644 --- a/bootstrap/Makefile +++ b/bootstrap/Makefile @@ -1,5 +1,5 @@ SHELL = /bin/sh -PREFIX ?= /opt/cfncluster +DESTDIR ?= /opt/cfncluster install: install -d -m 755 $(DESTDIR) diff --git a/bootstrap/src/scripts/boot_as_compute b/bootstrap/src/scripts/boot_as_compute index d92b4db8d0..2aace4a50b 100755 --- a/bootstrap/src/scripts/boot_as_compute +++ b/bootstrap/src/scripts/boot_as_compute @@ -25,12 +25,101 @@ function error_exit () { # Run preinstall script if defined RC=0 if [ "${cfn_preinstall}" != "NONE" ]; then - wget -qO- ${cfn_preinstall} | /bin/sh || RC=1 + tmpfile=$(mktemp) + wget -qO- ${cfn_preinstall} > $tmpfile || RC=1 + if [ "${cfn_preinstall_args}" != "NONE" ]; then + args=${cfn_preinstall_args} + fi + /bin/sh $tmpfile $args || RC=1 + /bin/rm $tmpfile fi if [ $RC -ne 0 ]; then error_exit "Failed to run boot_as_compute preinstall" fi +## Non-scheduler specific functions +## + +# LVM, format, mount /ephemeral +RC=0 +mkdir -p /scratch +chmod 1777 /scratch +MAPPING=$(/usr/bin/ec2-metadata -b | grep ephemeral | awk '{print $2}' | sed 's/sd/xvd/') +for m in $MAPPING; do + stat -t /dev/${m} >/dev/null 2>&1 + check=$? + if [ ${check} -eq 0 ]; then + DEVS="${m} $DEVS" + fi +done +NUM_DEVS=0 +for d in $DEVS; do + d=/dev/${d} + dd if=/dev/zero of=${d} bs=32k count=1 + parted -s ${d} mklabel msdos + parted -s ${d} + parted -s -a optimal ${d} mkpart primary 1MB 100% + parted -s ${d} set 1 lvm on + let NUM_DEVS++ + PARTITIONS="${d}1 $PARTITIONS" +done +# sleep 10 seconds to let partitions settle (bug?) +sleep 10 + +# Setup LVM +pvcreate $PARTITIONS +vgcreate vg.01 $PARTITIONS +lvcreate -i $NUM_DEVS -I 64 -l 100%FREE -n lv_ephemeral vg.01 +if [ "$cfn_encrypted_ephemeral" == "true" ]; then + mkfs -q /dev/ram1 1024 + mkdir -p /root/keystore + mount /dev/ram1 /root/keystore + dd if=/dev/urandom of=/root/keystore/keyfile bs=1024 count=4 + chmod 0400 /root/keystore/keyfile + cryptsetup -q luksFormat /dev/vg.01/lv_ephemeral /root/keystore/keyfile + cryptsetup -d /root/keystore/keyfile luksOpen /dev/vg.01/lv_ephemeral ephemeral_luks + mkfs.xfs /dev/mapper/ephemeral_luks + mount -v -t xfs -o noatime,nodiratime /dev/mapper/ephemeral_luks /scratch +else + mkfs.xfs /dev/vg.01/lv_ephemeral + echo "/dev/vg.01/lv_ephemeral /scratch xfs noatime,nodiratime 0 0" >> /etc/fstab + mount -v /scratch +fi +chmod 1777 /scratch + +# Mount NFS exports +RC=0 +echo "$cfn_master:/home /home nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 +echo "$cfn_master:/shared /shared nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 +mount -v /home || RC=1 +mount -v /shared || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed during during NFS mounts" +fi + +# Configure ganglia +RC=0 +location=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/placement/availability-zone` || RC=1 +cd /etc/ganglia || RC=1 +/bin/cp -f /opt/cfncluster/templates/os/gmond.conf.COMPUTE gmond.conf || RC=1 +sed -i "s//${cfn_master}/" gmond.conf || RC=1 +sed -i "s//$location/" gmond.conf || RC=1 +chkconfig gmond on || RC=1 +service gmond start || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed during Ganglia setup" +fi + +# Adding nodewatcher to crontab +RC=0 +crontab -l > /tmp/root.crontab +echo "* * * * * cd /opt/cfncluster/nodewatcher && ./nodewatcher.py >> nodewatcher.log 2>&1" >> /tmp/root.crontab || RC=1 +crontab /tmp/root.crontab || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed to nodewatcher crontab" +fi + +## # Run boot as compute for a specific scheduler RC=0 /opt/cfncluster/scripts/${cfn_scheduler}/boot_as_compute >/var/log/cfncluster.log 2>&1 || RC=1 @@ -41,7 +130,13 @@ fi # Run postinstall script if defined RC=0 if [ "${cfn_postinstall}" != "NONE" ]; then - wget -qO- ${cfn_postinstall} | /bin/sh || RC=1 + tmpfile=$(mktemp) + wget -qO- ${cfn_postinstall} > $tmpfile || RC=1 + if [ "${cfn_postinstall_args}" != "NONE" ]; then + args=${cfn_postinstall_args} + fi + /bin/sh $tmpfile $args || RC=1 + /bin/rm $tmpfile fi if [ $RC -ne 0 ]; then error_exit "Failed to run boot_as_compute postinstall" diff --git a/bootstrap/src/scripts/boot_as_master b/bootstrap/src/scripts/boot_as_master index 679714ace4..082ecbb1bb 100755 --- a/bootstrap/src/scripts/boot_as_master +++ b/bootstrap/src/scripts/boot_as_master @@ -25,12 +25,174 @@ function error_exit () { # Run preinstall script if defined RC=0 if [ "${cfn_preinstall}" != "NONE" ]; then - wget -qO- ${cfn_preinstall} | /bin/sh || RC=1 + tmpfile=$(mktemp) + wget -qO- ${cfn_preinstall} > $tmpfile || RC=1 + if [ "${cfn_preinstall_args}" != "NONE" ]; then + args=${cfn_preinstall_args} + fi + /bin/sh $tmpfile $args || RC=1 + /bin/rm $tmpfile fi if [ $RC -ne 0 ]; then error_exit "Failed to run boot_as_master preinstall" fi +## Non-scheduler specific functions +## + +# Check cfn_volume is present in config +if [ "${cfn_volume}x" == "x" ]; then + error_exit "Volume must be provided." +fi + +# Check hostname resolves using DNS +myhostname=$(hostname -s) +if [ $? != 0 ]; then + error_exit 'Failed to determine local hostname' +fi + +# Enable PAT +RC=0 +/opt/cfncluster/scripts/os/configure-pat.sh || RC=1 +echo -e "\n# Enable PAT\n/opt/cfncluster/scripts/os/configure-pat.sh\n\n" >> /etc/rc.local || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed to enable NAT(PAT)" +fi + +# LVM, format, mount /ephemeral +RC=0 +mkdir -p /scratch +chmod 1777 /scratch +MAPPING=$(/usr/bin/ec2-metadata -b | grep ephemeral | awk '{print $2}' | sed 's/sd/xvd/') +for m in $MAPPING; do + stat -t /dev/${m} >/dev/null 2>&1 + check=$? + if [ ${check} -eq 0 ]; then + DEVS="${m} $DEVS" + fi +done +NUM_DEVS=0 +for d in $DEVS; do + d=/dev/${d} + dd if=/dev/zero of=${d} bs=32k count=1 + parted -s ${d} mklabel msdos + parted -s ${d} + parted -s -a optimal ${d} mkpart primary 1MB 100% + parted -s ${d} set 1 lvm on + let NUM_DEVS++ + PARTITIONS="${d}1 $PARTITIONS" +done +# sleep 10 seconds to let partitions settle (bug?) +sleep 10 + +# Setup LVM +pvcreate $PARTITIONS +vgcreate vg.01 $PARTITIONS +lvcreate -i $NUM_DEVS -I 64 -l 100%FREE -n lv_ephemeral vg.01 +if [ "$cfn_encrypted_ephemeral" == "true" ]; then + mkfs -q /dev/ram1 1024 + mkdir -p /root/keystore + mount /dev/ram1 /root/keystore + dd if=/dev/urandom of=/root/keystore/keyfile bs=1024 count=4 + chmod 0400 /root/keystore/keyfile + cryptsetup -q luksFormat /dev/vg.01/lv_ephemeral /root/keystore/keyfile + cryptsetup -d /root/keystore/keyfile luksOpen /dev/vg.01/lv_ephemeral ephemeral_luks + mkfs.xfs /dev/mapper/ephemeral_luks + mount -v -t xfs -o noatime,nodiratime /dev/mapper/ephemeral_luks /scratch +else + mkfs.xfs /dev/vg.01/lv_ephemeral + echo "/dev/vg.01/lv_ephemeral /scratch xfs noatime,nodiratime 0 0" >> /etc/fstab + mount -v /scratch +fi +chmod 1777 /scratch + +# Attach and mount /shared volume +RC=0 +/usr/local/sbin/attachVolume.py ${cfn_volume} || RC=1 +sleep 10 # Hate having to do this... +dev=$(stat /dev/disk/by-ebs-volumeid/${cfn_volume}|grep -- 'File:'|awk '{print $4}'|cut -d'/' -f3|tr -d "'") +fs_type=$(blkid -o list | grep -- "$dev" | awk '{print $2}') +if [ "${fs_type}x" == "x" ]; then + mkfs.xfs /dev/disk/by-ebs-volumeid/${cfn_volume} || RC=1 + sleep 5 +fi +fs_type=$(blkid -o list | grep -- "$dev" | awk '{print $2}') +echo "/dev/disk/by-ebs-volumeid/${cfn_volume} /shared $fs_type noatime,nodiratime 0 0" >> /etc/fstab +mount -v /shared || RC=1 +chmod 1777 /shared || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed to attach and mount volume" +fi + +# Setup NFS as Master +# 1. Determine subnet for NFS exports +ETH0_MAC=`/sbin/ifconfig | /bin/grep eth0 | awk '{print tolower($5)}' | grep '^[0-9a-f]\{2\}\(:[0-9a-f]\{2\}\)\{5\}$'` +VPC_CIDR_URI="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${ETH0_MAC}/vpc-ipv4-cidr-block" +VPC_CIDR_RANGE=`curl --retry 3 --retry-delay 0 --silent --fail ${VPC_CIDR_URI}` +if [ $? -ne 0 ] ; then + echo "Unable to retrive VPC CIDR range from meta-data. This either means a) non-VPC or b) an error" | logger -t "cfncluster" + VPC_CIDR_RANGE="10.0.0.0/8" +else + echo "Retrived the VPC CIDR range: ${VPC_CIDR_RANGE} from meta-data for NFS export." | logger -t "cfncluster" +fi +# 2. Update config +RC=0 +cd /etc || RC=1 +/bin/cp -f /opt/cfncluster/templates/os/exports.MASTER exports || RC=1 +sed -i "s??$VPC_CIDR_RANGE?" exports || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed to configure NFS exports" +fi +# 3. Start NFS +RC=0 +chkconfig nfs on || RC=1 +chkconfig rpcbind on || RC=1 +chkconfig rpcidmapd on || RC=1 +service rpcbind restart || RC=1 +service rpcidmapd restart || RC=1 +service nfs restart || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed to start NFS server" +fi + +# Setup Ganglia as Master +RC=0 +location=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/placement/availability-zone` || RC=1 +cd /etc/ganglia || RC=1 +/bin/cp -f /opt/cfncluster/templates/os/gmond.conf.MASTER gmond.conf || RC=1 +/bin/cp -f /opt/cfncluster/templates/os/gmetad.conf.MASTER gmetad.conf || RC=1 +sed -i "s//$myhostname/" gmond.conf || RC=1 +sed -i "s//$location/" gmond.conf || RC=1 +sed -i "s//$stack_name/" gmond.conf || RC=1 +sed -i "s//$stack_name/" gmetad.conf || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed to configure Ganglia" +fi + +# Start httpd and ganglia services +RC=0 +chkconfig gmond on || RC=1 +chkconfig gmetad on || RC=1 +chkconfig httpd on || RC=1 +service gmond start || RC=1 +service gmetad start || RC=1 +service httpd start || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed to start Ganglia" +fi + +# Setup ec2-user SSH auth +RC=0 +su - ec2-user -c "ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ''" || RC=1 +su - ec2-user -c "cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys2 && chmod 0600 ~/.ssh/authorized_keys2" || RC=1 +su - ec2-user -c "ssh-keyscan ${myhostname} > ~/.ssh/known_hosts && chmod 0600 ~/.ssh/known_hosts" || RC=1 +if [ $RC -ne 0 ]; then + error_exit "Failed to setup ec2-user SSH auth" +fi + +## Scheduler specific section +## + # Run boot as master for a specific scheduler RC=0 /opt/cfncluster/scripts/${cfn_scheduler}/boot_as_master >/var/log/cfncluster.log 2>&1 || RC=1 @@ -44,7 +206,13 @@ cd /opt/cfncluster/sqswatcher && ./sqswatcher.py 2>&1 # Run postinstall script if defined RC=0 if [ "${cfn_postinstall}" != "NONE" ]; then - wget -qO- ${cfn_postinstall} | /bin/sh || RC=1 + tmpfile=$(mktemp) + wget -qO- ${cfn_postinstall} > $tmpfile || RC=1 + if [ "${cfn_postinstall_args}" != "NONE" ]; then + args=${cfn_postinstall_args} + fi + /bin/sh $tmpfile $args || RC=1 + /bin/rm $tmpfile fi if [ $RC -ne 0 ]; then error_exit "Failed to run boot_as_master postinstall" diff --git a/bootstrap/src/scripts/openlava/boot_as_compute b/bootstrap/src/scripts/openlava/boot_as_compute index 003d3a07f6..f54e8ded49 100755 --- a/bootstrap/src/scripts/openlava/boot_as_compute +++ b/bootstrap/src/scripts/openlava/boot_as_compute @@ -39,34 +39,6 @@ instance_type=$(echo $instance_type| tr '.' '_') # Setup resources resources="cs $instance_type $cfn_resources" -# Mount NFS exports -function mount_nfs () { -RC=0 -echo "$cfn_master:/home /home nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 -echo "$cfn_master:/shared /shared nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 -mount -v /home || RC=1 -mount -v /shared || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed during during NFS mounts" -fi -} - -# Configure ganglia -function configure_ganglia () { -RC=0 -location=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/placement/availability-zone` || RC=1 -cd /etc/ganglia || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmond.conf.COMPUTE gmond.conf || RC=1 -sed -i "s//$cfn_master/" gmond.conf || RC=1 -sed -i "s//$location/" gmond.conf || RC=1 -sed -i "s//$stack_name/" gmond.conf || RC=1 -chkconfig gmond on || RC=1 -service gmond start || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed during Ganglia setup" -fi -} - # Configure openlava function configure_openlava () { RC=0 @@ -93,23 +65,9 @@ if [ $RC -ne 0 ]; then fi } -# Adding nodewatcher to crontab -function add_nodewatcher () { -RC=0 -crontab -l > /tmp/root.crontab -echo "* * * * * cd /opt/cfncluster/nodewatcher && ./nodewatcher.py >> nodewatcher.log 2>&1" >> /tmp/root.crontab || RC=1 -crontab /tmp/root.crontab || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to nodewatcher crontab" -fi -} - function minimal_install () { - mount_nfs - configure_ganglia configure_openlava start_openlava - add_nodewatcher } ## Main script diff --git a/bootstrap/src/scripts/openlava/boot_as_master b/bootstrap/src/scripts/openlava/boot_as_master index 9162f68247..4c9027822f 100755 --- a/bootstrap/src/scripts/openlava/boot_as_master +++ b/bootstrap/src/scripts/openlava/boot_as_master @@ -23,108 +23,11 @@ function error_exit () { exit 1 } -if [ "${cfn_volume}x" == "x" ]; then - error_exit "Volume must be provided." -fi - myhostname=$(hostname -s) if [ $? != 0 ]; then error_exit 'Failed to determine local hostname' fi -# Enable PAT -function enable_pat () { -RC=0 -/opt/cfncluster/scripts/os/configure-pat.sh || RC=1 -echo -e "\n# Enable PAT\n/opt/cfncluster/scripts/os/configure-pat.sh\n\n" >> /etc/rc.local || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to enable NAT(PAT)" -fi -} - -# Attach and mount volume -function attach_mount_volume () { -RC=0 -/usr/local/sbin/attachVolume.py ${cfn_volume} || RC=1 -sleep 10 # Hate having to do this... -dev=$(stat /dev/disk/by-ebs-volumeid/${cfn_volume}|grep -- 'File:'|awk '{print $4}'|cut -d'/' -f3|tr -d "'") -fs_type=$(blkid -o list | grep -- "$dev" | awk '{print $2}') -if [ "${fs_type}x" == "x" ]; then - mkfs.xfs /dev/disk/by-ebs-volumeid/${cfn_volume} || RC=1 - sleep 5 -fi -fs_type=$(blkid -o list | grep -- "$dev" | awk '{print $2}') -echo "/dev/disk/by-ebs-volumeid/${cfn_volume} /shared $fs_type noatime,nodiratime 0 0" >> /etc/fstab -mount -v /shared || RC=1 -chmod 1777 /shared || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to attach and mount volume" -fi -} - -# Setup NFS as Master -function setup_master_nfs () { -# 1. Determine subnet for NFS exports -ETH0_MAC=`/sbin/ifconfig | /bin/grep eth0 | awk '{print tolower($5)}' | grep '^[0-9a-f]\{2\}\(:[0-9a-f]\{2\}\)\{5\}$'` -VPC_CIDR_URI="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${ETH0_MAC}/vpc-ipv4-cidr-block" -VPC_CIDR_RANGE=`curl --retry 3 --retry-delay 0 --silent --fail ${VPC_CIDR_URI}` -if [ $? -ne 0 ] ; then - echo "Unable to retrive VPC CIDR range from meta-data. This either means a) non-VPC or b) an error" | logger -t "cfncluster" - VPC_CIDR_RANGE="10.0.0.0/8" -else - echo "Retrived the VPC CIDR range: ${VPC_CIDR_RANGE} from meta-data for NFS export." | logger -t "cfncluster" -fi -# 2. Update config -RC=0 -cd /etc || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/exports.MASTER exports || RC=1 -sed -i "s??$VPC_CIDR_RANGE?" exports || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to configure NFS exports" -fi -# 3. Start NFS -RC=0 -chkconfig nfs on || RC=1 -chkconfig rpcbind on || RC=1 -chkconfig rpcidmapd on || RC=1 -service rpcbind restart || RC=1 -service rpcidmapd restart || RC=1 -service nfs restart || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to start NFS server" -fi -} - -# Setup Ganglia as Master -function setup_master_ganglia () { -RC=0 -location=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/placement/availability-zone` || RC=1 -cd /etc/ganglia || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmond.conf.MASTER gmond.conf || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmetad.conf.MASTER gmetad.conf || RC=1 -sed -i "s//$myhostname/" gmond.conf || RC=1 -sed -i "s//$location/" gmond.conf || RC=1 -sed -i "s//$stack_name/" gmond.conf || RC=1 -sed -i "s//$stack_name/" gmetad.conf || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to configure Ganglia" -fi -} - -# Start httpd and ganglia services -function start_http_ganglia () { -RC=0 -chkconfig gmond on || RC=1 -chkconfig gmetad on || RC=1 -chkconfig httpd on || RC=1 -service gmond start || RC=1 -service gmetad start || RC=1 -service httpd start || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to start Ganglia" -fi -} - # Setup openlava config as Master function setup_master_openlava () { RC=0 @@ -152,17 +55,6 @@ if [ $RC -ne 0 ]; then fi } -# Setup ec2-user SSH auth -function setup_ssh_auth () { -RC=0 -su - ec2-user -c "ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ''" || RC=1 -su - ec2-user -c "cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys2 && chmod 0600 ~/.ssh/authorized_keys2" || RC=1 -su - ec2-user -c "ssh-keyscan ${myhostname} > ~/.ssh/known_hosts && chmod 0600 ~/.ssh/known_hosts" || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to setup ec2-user SSH auth" -fi -} - # Start openlava function start_openlava () { RC=0 @@ -176,15 +68,9 @@ fi } function minimal_install () { - enable_pat - attach_mount_volume - setup_master_nfs - setup_master_ganglia - start_http_ganglia setup_master_openlava start_openlava add_custom_metric - setup_ssh_auth } ## Main script diff --git a/bootstrap/src/scripts/sge/boot_as_compute b/bootstrap/src/scripts/sge/boot_as_compute index dfcdea1665..463278f337 100755 --- a/bootstrap/src/scripts/sge/boot_as_compute +++ b/bootstrap/src/scripts/sge/boot_as_compute @@ -32,36 +32,13 @@ if [ $? != 0 ]; then error_exit 'Failed to determine short hostname.' fi -# Determine instance type -instance_type=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/instance-type` -instance_type=$(echo $instance_type| tr '.' '_') - -# Mount NFS exports +# Mount SGE NFS exports function mount_nfs () { RC=0 -echo "$cfn_master:/home /home nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 -echo "$cfn_master:/shared /shared nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 echo "$cfn_master:/opt/sge /opt/sge nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 -mount -v /home || RC=1 -mount -v /shared || RC=1 mount -v /opt/sge || RC=1 if [ $RC -ne 0 ]; then - error_exit "Failed during during NFS mounts" -fi -} - -# Configure ganglia -function configure_ganglia () { -RC=0 -location=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/placement/availability-zone` || RC=1 -cd /etc/ganglia || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmond.conf.COMPUTE gmond.conf || RC=1 -sed -i "s//$cfn_master/" gmond.conf || RC=1 -sed -i "s//$location/" gmond.conf || RC=1 -chkconfig gmond on || RC=1 -service gmond start || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed during Ganglia setup" + error_exit "Failed during during SGE NFS mounts" fi } @@ -75,27 +52,9 @@ if [ $RC -ne 0 ]; then fi } -# Adding nodewatcher to crontab -function add_nodewatcher () { -RC=0 -crontab -l > /tmp/root.crontab -echo "* * * * * cd /opt/cfncluster/nodewatcher && ./nodewatcher.py >> nodewatcher.log 2>&1" >> /tmp/root.crontab || RC=1 -crontab /tmp/root.crontab || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to nodewatcher crontab" -fi -} - function minimal_install () { mount_nfs setup_sge_profile - add_nodewatcher -} - -function full_install () { - mount_nfs - configure_ganglia - add_nodewatcher } ## Main script @@ -104,10 +63,6 @@ case $cfn_install_type in minimal_install ;; - full) - full_install - ;; - *) error_exit "Unkown install type: $cfn_install_type" diff --git a/bootstrap/src/scripts/sge/boot_as_master b/bootstrap/src/scripts/sge/boot_as_master index a5470e9347..4199e81c46 100755 --- a/bootstrap/src/scripts/sge/boot_as_master +++ b/bootstrap/src/scripts/sge/boot_as_master @@ -23,88 +23,11 @@ function error_exit () { exit 1 } -if [ "${cfn_volume}x" == "x" ]; then - error_exit "Volume must be provided." -fi - myhostname=$(hostname -s) if [ $? != 0 ]; then error_exit 'Failed to determine local hostname' fi -# Enable PAT -function enable_pat () { -RC=0 -/opt/cfncluster/scripts/os/configure-pat.sh || RC=1 -echo -e "\n# Enable PAT\n/opt/cfncluster/scripts/os/configure-pat.sh\n\n" >> /etc/rc.local || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to enable NAT(PAT)" -fi -} - -# Set MOTD -function set_motd () { -RC=0 -cd /etc || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/motd.MASTER motd || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to update /etc/motd" -fi -} - -# Attache and mount volume -function attach_mount_volume () { -RC=0 -/usr/local/sbin/attachVolume.py ${cfn_volume} || RC=1 -sleep 10 # Hate having to do this... -dev=$(stat /dev/disk/by-ebs-volumeid/${cfn_volume}|grep -- 'File:'|awk '{print $4}'|cut -d'/' -f3|tr -d "'") -fs_type=$(blkid -o list | grep -- "$dev" | awk '{print $2}') -if [ "${fs_type}x" == "x" ]; then - mkfs.xfs /dev/disk/by-ebs-volumeid/${cfn_volume} || RC=1 - sleep 5 -fi -fs_type=$(blkid -o list | grep -- "$dev" | awk '{print $2}') -echo "/dev/disk/by-ebs-volumeid/${cfn_volume} /shared $fs_type noatime,nodiratime 0 0" >> /etc/fstab -mount -v /shared || RC=1 -chmod 1777 /shared || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to attach and mount volume" -fi -} - -# Setup NFS as Master -function setup_master_nfs () { -# 1. Determine subnet for NFS exports -ETH0_MAC=`/sbin/ifconfig | /bin/grep eth0 | awk '{print tolower($5)}' | grep '^[0-9a-f]\{2\}\(:[0-9a-f]\{2\}\)\{5\}$'` -VPC_CIDR_URI="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${ETH0_MAC}/vpc-ipv4-cidr-block" -VPC_CIDR_RANGE=`curl --retry 3 --retry-delay 0 --silent --fail ${VPC_CIDR_URI}` -if [ $? -ne 0 ] ; then - echo "Unable to retrive VPC CIDR range from meta-data. This either means a) non-VPC or b) an error" | logger -t "cfncluster" - VPC_CIDR_RANGE="10.0.0.0/8" -else - echo "Retrived the VPC CIDR range: ${VPC_CIDR_RANGE} from meta-data for NFS export." | logger -t "cfncluster" -fi -# 2. Update config -RC=0 -cd /etc || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/exports.MASTER exports || RC=1 -sed -i "s??$VPC_CIDR_RANGE?" exports || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to configure NFS exports" -fi -# 3. Start NFS -RC=0 -chkconfig nfs on || RC=1 -chkconfig rpcbind on || RC=1 -chkconfig rpcidmapd on || RC=1 -service rpcbind restart || RC=1 -service rpcidmapd restart || RC=1 -service nfs restart || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to start NFS server" -fi -} - # Setup SGE config as Master function setup_master_sge () { RC=0 @@ -117,48 +40,6 @@ if [ $RC -ne 0 ]; then fi } -# Setup Ganglia as Master -function setup_master_ganglia () { -RC=0 -location=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/placement/availability-zone` || RC=1 -cd /etc/ganglia || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmond.conf.MASTER gmond.conf || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmetad.conf.MASTER gmetad.conf || RC=1 -sed -i "s//$myhostname/" gmond.conf || RC=1 -sed -i "s//$location/" gmond.conf || RC=1 -sed -i "s//$stack_name/" gmond.conf || RC=1 -sed -i "s//$stack_name/" gmetad.conf || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to configure Ganglia" -fi -} - -# Start httpd and ganglia services -function start_http_ganglia () { -RC=0 -chkconfig gmond on || RC=1 -chkconfig gmetad on || RC=1 -chkconfig httpd on || RC=1 -service gmond start || RC=1 -service gmetad start || RC=1 -service httpd start || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to start Ganglia" -fi -} - -# Start VNC server for ec2user -function start_vncserver () { -RC=0 -cd /etc/sysconfig || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/tvncservers.MASTER tvncservers || RC=1 -chkconfig tvncserver on || RC=1 -service tvncserver start || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to setup TurboVNC" -fi -} - # Start SGE function start_sge () { RC=0 @@ -190,28 +71,11 @@ if [ $RC -ne 0 ]; then fi } -# Setup ec2-user SSH auth -function setup_ssh_auth () { -RC=0 -su - ec2-user -c "ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ''" || RC=1 -su - ec2-user -c "cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys2 && chmod 0600 ~/.ssh/authorized_keys2" || RC=1 -su - ec2-user -c "ssh-keyscan ${myhostname} > ~/.ssh/known_hosts && chmod 0600 ~/.ssh/known_hosts" || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to setup ec2-user SSH auth" -fi -} - function minimal_install () { - enable_pat - attach_mount_volume - setup_master_nfs setup_master_sge - setup_master_ganglia - start_http_ganglia start_sge add_master_submit add_custom_metric - setup_ssh_auth } ## Main script diff --git a/bootstrap/src/scripts/torque/boot_as_compute b/bootstrap/src/scripts/torque/boot_as_compute index 7f4330102d..28a0e0d77e 100755 --- a/bootstrap/src/scripts/torque/boot_as_compute +++ b/bootstrap/src/scripts/torque/boot_as_compute @@ -32,23 +32,6 @@ if [ $? != 0 ]; then error_exit 'Failed to determine short hostname.' fi -# Determine instance type -instance_type=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/instance-type` -instance_type=$(echo $instance_type| tr '.' '_') - -# Mount NFS exports -function mount_nfs () { -RC=0 -echo "$cfn_master:/home /home nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 -echo "$cfn_master:/shared /shared nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 -echo "$cfn_master:/opt/sge /opt/sge nfs hard,intr,noatime,vers=3,_netdev 0 0" >> /etc/fstab || RC=1 -mount -v /home || RC=1 -mount -v /shared || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed during during NFS mounts" -fi -} - function setup_torque () { RC=0 . /opt/cfncluster/templates/torque/torque.sh || RC=1 @@ -70,43 +53,8 @@ if [ $RC -ne 0 ]; then fi } -# Configure ganglia -function configure_ganglia () { -RC=0 -location=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/placement/availability-zone` || RC=1 -cd /etc/ganglia || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmond.conf.COMPUTE gmond.conf || RC=1 -sed -i "s//$cfn_master/" gmond.conf || RC=1 -sed -i "s//$location/" gmond.conf || RC=1 -chkconfig gmond on || RC=1 -service gmond start || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed during Ganglia setup" -fi -} - -# Adding nodewatcher to crontab -function add_nodewatcher () { -RC=0 -crontab -l > /tmp/root.crontab -echo "* * * * * cd /opt/cfncluster/nodewatcher && ./nodewatcher.py >> nodewatcher.log 2>&1" >> /tmp/root.crontab || RC=1 -crontab /tmp/root.crontab || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to nodewatcher crontab" -fi -} - function minimal_install () { - mount_nfs setup_torque - add_nodewatcher -} - -function full_install () { - mount_nfs - configure_ganglia - setup_torque - add_nodewatcher } ## Main script @@ -115,10 +63,6 @@ case $cfn_install_type in minimal_install ;; - full) - full_install - ;; - *) error_exit "Unkown install type: $cfn_install_type" diff --git a/bootstrap/src/scripts/torque/boot_as_master b/bootstrap/src/scripts/torque/boot_as_master index 0c9435a05b..62f33a9934 100755 --- a/bootstrap/src/scripts/torque/boot_as_master +++ b/bootstrap/src/scripts/torque/boot_as_master @@ -23,78 +23,11 @@ function error_exit () { exit 1 } -if [ "${cfn_volume}x" == "x" ]; then - error_exit "Volume must be provided." -fi - myhostname=$(hostname -s) if [ $? != 0 ]; then error_exit 'Failed to determine local hostname' fi -# Enable PAT -function enable_pat () { -RC=0 -/opt/cfncluster/scripts/os/configure-pat.sh || RC=1 -echo -e "\n# Enable PAT\n/opt/cfncluster/scripts/os/configure-pat.sh\n\n" >> /etc/rc.local || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to enable NAT(PAT)" -fi -} - -# Attache and mount volume -function attach_mount_volume () { -RC=0 -/usr/local/sbin/attachVolume.py ${cfn_volume} || RC=1 -sleep 10 # Hate having to do this... -dev=$(stat /dev/disk/by-ebs-volumeid/${cfn_volume}|grep -- 'File:'|awk '{print $4}'|cut -d'/' -f3|tr -d "'") -fs_type=$(blkid -o list | grep -- "$dev" | awk '{print $2}') -if [ "${fs_type}x" == "x" ]; then - mkfs.xfs /dev/disk/by-ebs-volumeid/${cfn_volume} || RC=1 - sleep 5 -fi -fs_type=$(blkid -o list | grep -- "$dev" | awk '{print $2}') -echo "/dev/disk/by-ebs-volumeid/${cfn_volume} /shared $fs_type noatime,nodiratime 0 0" >> /etc/fstab -mount -v /shared || RC=1 -chmod 1777 /shared || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to attach and mount volume" -fi -} - -# Setup NFS as Master -function setup_master_nfs () { -# 1. Determine subnet for NFS exports -ETH0_MAC=`/sbin/ifconfig | /bin/grep eth0 | awk '{print tolower($5)}' | grep '^[0-9a-f]\{2\}\(:[0-9a-f]\{2\}\)\{5\}$'` -VPC_CIDR_URI="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${ETH0_MAC}/vpc-ipv4-cidr-block" -VPC_CIDR_RANGE=`curl --retry 3 --retry-delay 0 --silent --fail ${VPC_CIDR_URI}` -if [ $? -ne 0 ] ; then - echo "Unable to retrive VPC CIDR range from meta-data. This either means a) non-VPC or b) an error" | logger -t "cfncluster" - VPC_CIDR_RANGE="10.0.0.0/8" -else - echo "Retrived the VPC CIDR range: ${VPC_CIDR_RANGE} from meta-data for NFS export." | logger -t "cfncluster" -fi -# 2. Update config -RC=0 -cd /etc || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/exports.MASTER exports || RC=1 -sed -i "s??$VPC_CIDR_RANGE?" exports || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to configure NFS exports" -fi -# 3. Start NFS -RC=0 -chkconfig nfs on || RC=1 -chkconfig rpcbind on || RC=1 -chkconfig rpcidmapd on || RC=1 -service rpcbind restart || RC=1 -service rpcidmapd restart || RC=1 -service nfs restart || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to start NFS server" -fi -} - # Setup Torque on master function setup_master_torque () { RC=0 @@ -118,48 +51,6 @@ if [ $RC -ne 0 ]; then fi } -# Setup Ganglia as Master -function setup_master_ganglia () { -RC=0 -location=`curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/placement/availability-zone` || RC=1 -cd /etc/ganglia || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmond.conf.MASTER gmond.conf || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/gmetad.conf.MASTER gmetad.conf || RC=1 -sed -i "s//$myhostname/" gmond.conf || RC=1 -sed -i "s//$location/" gmond.conf || RC=1 -sed -i "s//$stack_name/" gmond.conf || RC=1 -sed -i "s//$stack_name/" gmetad.conf || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to configure Ganglia" -fi -} - -# Start httpd and ganglia services -function start_http_ganglia () { -RC=0 -chkconfig gmond on || RC=1 -chkconfig gmetad on || RC=1 -chkconfig httpd on || RC=1 -service gmond start || RC=1 -service gmetad start || RC=1 -service httpd start || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to start Ganglia" -fi -} - -# Start VNC server for ec2user -function start_vncserver () { -RC=0 -cd /etc/sysconfig || RC=1 -/bin/cp -f /opt/cfncluster/templates/os/tvncservers.MASTER tvncservers || RC=1 -chkconfig tvncserver on || RC=1 -service tvncserver start || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to setup TurboVNC" -fi -} - # Adding custom CloudWatch metric to crontab function add_custom_metric () { RC=0 @@ -171,26 +62,9 @@ if [ $RC -ne 0 ]; then fi } -# Setup ec2-user SSH auth -function setup_ssh_auth () { -RC=0 -su - ec2-user -c "ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ''" || RC=1 -su - ec2-user -c "cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys2 && chmod 0600 ~/.ssh/authorized_keys2" || RC=1 -su - ec2-user -c "ssh-keyscan $(hostname -f),$(hostname -s) > ~/.ssh/known_hosts && chmod 0600 ~/.ssh/known_hosts" || RC=1 -if [ $RC -ne 0 ]; then - error_exit "Failed to setup ec2-user SSH auth" -fi -} - function minimal_install () { - enable_pat - attach_mount_volume - setup_master_nfs setup_master_torque - setup_master_ganglia - start_http_ganglia add_custom_metric - setup_ssh_auth } ## Main script diff --git a/cli/cfncluster/cfnconfig.py b/cli/cfncluster/cfnconfig.py index ed56d1b8fb..fc24ff6c79 100644 --- a/cli/cfncluster/cfnconfig.py +++ b/cli/cfncluster/cfnconfig.py @@ -116,7 +116,7 @@ def __init__(self, args): vpc_base_eni='VPCBaseNATENI1', compute_uses_public_subnet='ComputeUsesPublicSubnet', vpc_base_security_group='VPCBaseBackSecurityGroup', use_vpc_base='UseVPCBase', vpc_base_backend_subnet='VPCBaseBackendSubnet1', - availability_zones='AvailabilityZones') + availability_zones='AvailabilityZones', ssh_from='SSHFrom') # Loop over all VPC options and add define to parameters, raise Exception is defined but null for key in self.__vpc_options: @@ -135,7 +135,9 @@ def __init__(self, args): install_type='InstallType', scheduler='Scheduler', cluster_type='ClusterType', spot_price='SpotPrice', custom_ami='CustomAMI', pre_install='PreInstallScript', post_install='PostInstallScript', proxy_server='ProxyServer', - iam_policy='IAMPolicy', placement='Placement', placement_group='PlacementGroup') + iam_policy='IAMPolicy', placement='Placement', placement_group='PlacementGroup', + encrypted_ephemeral='EncryptedEphemeral',pre_install_args='PreInstallArgs', + post_install_args='PostInstallArgs') # Loop over all the cluster options and add define to parameters, raise Exception if defined but null for key in self.__cluster_options: diff --git a/cli/cfncluster/cli.py b/cli/cfncluster/cli.py index ba4414b95a..4fc33c2b1b 100644 --- a/cli/cfncluster/cli.py +++ b/cli/cfncluster/cli.py @@ -76,11 +76,13 @@ def main(): pcreate.add_argument("--norollback", "-nr", action='store_true', dest="norollback", default=False, help='disable stack rollback on error') pcreate.add_argument("--template-url", "-u", type=str, dest="template_url", default=None, - help='disable stack rollback on error') + help='specify a URL for a custom cloudformation template') pcreate.add_argument("--cluster-template", "-t", type=str, dest="cluster_template", default=None, - help='specific a specific cluster template to use') + help='specify a specific cluster template to use') pcreate.add_argument("--extra-parameters", "-p", type=str, dest="extra_parameters", default=None, help='add extra parameters to stack create') + pcreate.add_argument("--tags", "-g", type=str, dest="tags", default=None, + help='tags to be added to the stack') pcreate.set_defaults(func=create) pupdate = subparsers.add_parser('update', help='update a running cluster') @@ -89,9 +91,9 @@ def main(): pupdate.add_argument("--norollback", "-nr", action='store_true', dest="norollback", default=False, help='disable stack rollback on error') pupdate.add_argument("--template-url", "-u", type=str, dest="template_url", default=None, - help='disable stack rollback on error') + help='specify a URL for a custom cloudformation template') pupdate.add_argument("--cluster-template", "-t", type=str, dest="cluster_template", default=None, - help='disable stack rollback on error') + help='specify a specific cluster template to use') pupdate.add_argument("--extra-parameters", "-p", type=str, dest="extra_parameters", default=None, help='add extra parameters to stack update') pupdate.add_argument("--reset-desired", "-rd", action='store_true', dest="reset_desired", default=False, diff --git a/cli/cfncluster/examples/config b/cli/cfncluster/examples/config index 77c5b53653..f72b033ddc 100644 --- a/cli/cfncluster/examples/config +++ b/cli/cfncluster/examples/config @@ -59,12 +59,27 @@ key_name = mykey # URL to a preinstall script. This is executed before any of the boot_as_* scripts are run # (defaults to NONE for the default template) #pre_install = NONE +# Arguments to be passed to preinstall script +# (defaults to NONE for the default template) +#pre_install_args = NONE # URL to a postinstall script. This is executed after any of the boot_as_* scripts are run # (defaults to NONE for the default template) #post_install = NONE +# Arguments to be passed to postinstall script +# (defaults to NONE for the default template) +#post_install_args = NONE # HTTP(S) proxy server, typically http://x.x.x.x:8080 # (defaults to NONE for the default template) #proxy_server = NONE +# Cluster placement group. This placement group must already exist. +# (defaults to NONE for the default template) +#placement_group = NONE +# Cluster placment logic. This enables the whole cluster or only compute to use the placement group +# (defaults to cluster in the default template) +#placement = cluster +# Encrypted ephemeral drives. In-memory keys, non-recoverable. +# (defaults to false in default template) +#encrypted_ephemeral = false # Settings section relating to VPC to be used vpc_settings = public # Settings section relating to EBS volume @@ -82,6 +97,10 @@ public_subnet = subnet- # This is a comma delimited list and must always contain three values # Example: us-west-2a,NONE,NONE availability_zones = +# SSH from CIDR +# This is only used when cfncluster creates the security group +# (defaults to 0.0.0.0/0 in the default template) +#ssh_from = 0.0.0.0/0 #[vpc private] # Boolean flag to launch compute with direct egress or behind the Master server. diff --git a/cli/setup.py b/cli/setup.py index 0735537403..e5e52f767c 100644 --- a/cli/setup.py +++ b/cli/setup.py @@ -20,7 +20,7 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() console_scripts = ['cfncluster = cfncluster.cli:main'] -version = "0.0.6" +version = "0.0.7" setup( name = "cfncluster", diff --git a/cloudformation/cfncluster.cfn.json b/cloudformation/cfncluster.cfn.json index 9458cdb708..06b06a8ab4 100644 --- a/cloudformation/cfncluster.cfn.json +++ b/cloudformation/cfncluster.cfn.json @@ -275,6 +275,40 @@ "Description" : "Addtional policy document to be added to EC2 IAM role created and assigned to all nodes.", "Type" : "String", "Default" : "NONE" + }, + "Placement" : { + "Description" : "Type of placement requird in cfncluster, it can either be cluster or compute.", + "Type" : "String", + "Default" : "cluster", + "AllowedValues" : [ + "cluster", + "compute" + ] + }, + "PlacementGroup" : { + "Description" : "The name of an exisiting placement group", + "Type" : "String", + "Default" : "NONE" + }, + "EncryptedEphemeral" : { + "Description" : "Boolean flag to encrypt local ephemeral drives. The keys are in-memory and non-recoverable.", + "Type" : "String", + "Default" : "true", + "ConstraintDescription" : "true/false", + "AllowedValues" : [ + "true", + "false" + ] + }, + "PreInstallArgs" : { + "Description" : "Preinstall script args passed to the preinstall script.", + "Type" : "String", + "Default" : "NONE" + }, + "PostInstallArgs" : { + "Description" : "Postinstall script args passed to the postinstall script.", + "Type" : "String", + "Default" : "NONE" } }, "Conditions" : { @@ -380,6 +414,26 @@ ] } ] + }, + "UsePlacementGroup" : { + "Fn::Not" : [ + { + "Fn::Equals" : [ + { + "Ref" : "PlacementGroup" + }, + "NONE" + ] + } + ] + }, + "UseClusterPlacement" : { + "Fn::Equals" : [ + { + "Ref" : "Placement" + }, + "cluster" + ] } }, "Mappings" : { @@ -753,6 +807,24 @@ "InstanceType" : { "Ref" : "MasterInstanceType" }, + "BlockDeviceMappings" : [ + { + "DeviceName" : "/dev/sdb", + "VirtualName" : "ephemeral0" + }, + { + "DeviceName" : "/dev/sdc", + "VirtualName" : "ephemeral1" + }, + { + "DeviceName" : "/dev/sdd", + "VirtualName" : "ephemeral2" + }, + { + "DeviceName" : "/dev/sde", + "VirtualName" : "ephemeral3" + } + ], "KeyName" : { "Ref" : "KeyName" }, @@ -864,6 +936,17 @@ }, "IamInstanceProfile" : { "Ref" : "RootInstanceProfile" + }, + "PlacementGroupName" : { + "Fn::If" : [ + "UseClusterPlacement", + { + "Ref" : "PlacementGroup" + }, + { + "Ref" : "AWS::NoValue" + } + ] } }, "Metadata" : { @@ -892,11 +975,21 @@ "Ref" : "PreInstallScript" }, "\n", + "cfn_preinstall_args=", + { + "Ref" : "PreInstallArgs" + }, + "\n", "cfn_postinstall=", { "Ref" : "PostInstallScript" }, "\n", + "cfn_postinstall_args=", + { + "Ref" : "PostInstallArgs" + }, + "\n", "cfn_region=", { "Ref" : "AWS::Region" @@ -912,6 +1005,11 @@ "Ref" : "Scheduler" }, "\n", + "cfn_encrypted_ephemeral=", + { + "Ref" : "EncryptedEphemeral" + }, + "\n", "cfn_node_type=MasterServer\n", "cfn_install_type=", { @@ -1049,7 +1147,18 @@ "Value" : "Compute", "PropagateAtLaunch" : "true" } - ] + ], + "PlacementGroup" : { + "Fn::If" : [ + "UsePlacementGroup", + { + "Ref" : "PlacementGroup" + }, + { + "Ref" : "AWS::NoValue" + } + ] + } }, "DependsOn" : "MasterServerWaitCondition" }, @@ -1079,6 +1188,24 @@ "InstanceType" : { "Ref" : "ComputeInstanceType" }, + "BlockDeviceMappings" : [ + { + "DeviceName" : "/dev/sdb", + "VirtualName" : "ephemeral0" + }, + { + "DeviceName" : "/dev/sdc", + "VirtualName" : "ephemeral1" + }, + { + "DeviceName" : "/dev/sdd", + "VirtualName" : "ephemeral2" + }, + { + "DeviceName" : "/dev/sde", + "VirtualName" : "ephemeral3" + } + ], "KeyName" : { "Ref" : "KeyName" }, @@ -1198,11 +1325,21 @@ "Ref" : "PreInstallScript" }, "\n", + "cfn_preinstall_args=", + { + "Ref" : "PreInstallArgs" + }, + "\n", "cfn_postinstall=", { "Ref" : "PostInstallScript" }, "\n", + "cfn_postinstall_args=", + { + "Ref" : "PostInstallArgs" + }, + "\n", "cfn_sqs_url=", { "Ref" : "SQS" @@ -1217,6 +1354,11 @@ }, "\n", "cfn_node_type=ComputeFleet\n", + "cfn_encrypted_ephemeral=", + { + "Ref" : "EncryptedEphemeral" + }, + "\n", "cfn_install_type=", { "Ref" : "InstallType"