From 1c36464615fd4b12ec6b3141d3d0173eac64bf75 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Tue, 13 Sep 2011 20:21:42 -0700 Subject: [PATCH] allow role configuration for multi-host lxc --- build_lxc.sh | 13 ++++++++----- stack.sh | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/build_lxc.sh b/build_lxc.sh index e3765db..97dd594 100755 --- a/build_lxc.sh +++ b/build_lxc.sh @@ -9,6 +9,9 @@ CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1} NAMESERVER=${NAMESERVER:-192.168.1.1} COPYENV=${COPYENV:-1} +# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova" +STACKSH_PARAMS=${STACKSH_PARAMS:-} + # Create lxc configuration LXC_CONF=/tmp/$CONTAINER.conf cat > $LXC_CONF < $INSTALL_SH < /etc/rc.local # Make sure dns is set up echo "nameserver $NAMESERVER" | resolvconf -a eth0 sleep 1 @@ -95,8 +96,10 @@ sleep 1 # Install and run stack.sh apt-get update apt-get -y --force-yes install git-core vim-nox sudo -su -c "git clone git://github.com/cloudbuilders/nfs-stack.git ~/nfs-stack" stack -su -c "cd ~/nfs-stack && ./stack.sh" stack +if [ ! -d "~/nfs-stack" ] + su -c "git clone git://github.com/cloudbuilders/nfs-stack.git ~/nfs-stack" stack +fi +su -c "cd ~/nfs-stack && $STACKSH_PARAMS ./stack.sh" stack EOF # Make the install.sh executable diff --git a/stack.sh b/stack.sh index 64c97da..0f6ea96 100755 --- a/stack.sh +++ b/stack.sh @@ -60,8 +60,8 @@ EC2_DMZ_HOST=${EC2_DMZ_HOST:-$HOST_IP} LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu} # Mysql connection info -MYSQL_PASS=${MYSQL_PASS:-nova} MYSQL_USER=${MYSQL_USER:-root} +MYSQL_PASS=${MYSQL_PASS:-nova} MYSQL_HOST=${MYSQL_HOST:-localhost} # don't specify /db in this string, so we can use it for multiple services BASE_SQL_CONN=${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASS@$MYSQL_HOST}