allow role configuration for multi-host lxc
This commit is contained in:
parent
fdaf21a5e6
commit
1c36464615
2 changed files with 9 additions and 6 deletions
13
build_lxc.sh
13
build_lxc.sh
|
@ -9,6 +9,9 @@ CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1}
|
||||||
NAMESERVER=${NAMESERVER:-192.168.1.1}
|
NAMESERVER=${NAMESERVER:-192.168.1.1}
|
||||||
COPYENV=${COPYENV:-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
|
# Create lxc configuration
|
||||||
LXC_CONF=/tmp/$CONTAINER.conf
|
LXC_CONF=/tmp/$CONTAINER.conf
|
||||||
cat > $LXC_CONF <<EOF
|
cat > $LXC_CONF <<EOF
|
||||||
|
@ -82,12 +85,10 @@ iface eth0 inet static
|
||||||
gateway $CONTAINER_GATEWAY
|
gateway $CONTAINER_GATEWAY
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Configure the first run installer
|
# Configure the runner
|
||||||
INSTALL_SH=$ROOTFS/root/install.sh
|
INSTALL_SH=$ROOTFS/root/install.sh
|
||||||
cat > $INSTALL_SH <<EOF
|
cat > $INSTALL_SH <<EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Disable startup script
|
|
||||||
echo \#\!/bin/sh -e > /etc/rc.local
|
|
||||||
# Make sure dns is set up
|
# Make sure dns is set up
|
||||||
echo "nameserver $NAMESERVER" | resolvconf -a eth0
|
echo "nameserver $NAMESERVER" | resolvconf -a eth0
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -95,8 +96,10 @@ sleep 1
|
||||||
# Install and run stack.sh
|
# Install and run stack.sh
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get -y --force-yes install git-core vim-nox sudo
|
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
|
if [ ! -d "~/nfs-stack" ]
|
||||||
su -c "cd ~/nfs-stack && ./stack.sh" 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
|
EOF
|
||||||
|
|
||||||
# Make the install.sh executable
|
# Make the install.sh executable
|
||||||
|
|
2
stack.sh
2
stack.sh
|
@ -60,8 +60,8 @@ EC2_DMZ_HOST=${EC2_DMZ_HOST:-$HOST_IP}
|
||||||
LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
|
LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu}
|
||||||
|
|
||||||
# Mysql connection info
|
# Mysql connection info
|
||||||
MYSQL_PASS=${MYSQL_PASS:-nova}
|
|
||||||
MYSQL_USER=${MYSQL_USER:-root}
|
MYSQL_USER=${MYSQL_USER:-root}
|
||||||
|
MYSQL_PASS=${MYSQL_PASS:-nova}
|
||||||
MYSQL_HOST=${MYSQL_HOST:-localhost}
|
MYSQL_HOST=${MYSQL_HOST:-localhost}
|
||||||
# don't specify /db in this string, so we can use it for multiple services
|
# 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}
|
BASE_SQL_CONN=${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASS@$MYSQL_HOST}
|
||||||
|
|
Loading…
Reference in a new issue