def bootstrap(): ip = socket.gethostbyname(env.host) # Setup network interface with open('workdir/config/network.conf') as fh: conf = fh.read() conf = StringIO(conf.format(ip_address=ip)) put(conf, '/etc/network/interfaces', use_sudo=True) sudo('chown root:root /etc/network/interfaces') sudo('service networking restart') # Setup rc.local with open('workdir/config/rc.local') as fh: conf = fh.read() conf = StringIO(conf.format(ip_address=ip)) put(conf, '/etc/rc.local', use_sudo=True, mode=0755) sudo('chown root:root /etc/rc.local') # Get ubuntu base image sudo('mkdir -p /var/lib/ipd/images /var/lib/ipd/cd') sudo('wget -O /var/lib/ipd/cd/ubuntu.iso \'http://www.ubuntu.com/start-download?distro=server&bits=64&release=latest\'')