Provisioning Vagrant with Babushka

188 views
Skip to first unread message

dkam

unread,
Nov 15, 2011, 10:44:39 PM11/15/11
to babushka_app
Hey guys,
Anyone tried setting up a Babushka provisioner for Vagrant?

I have a working shell version, but elegant it isn't.


---- https://gist.github.com/1369174
#!/bin/bash

# In your Vagrant file, add a shell provisioner, pointing to this
file:
#
# config.vm.provision :shell, :path => "babushka.sh"
#

# Install expect to answer Babushka install questions:
sudo aptitude install expect -y

# Download and chmod the Babushka installer:
wget -O up babushka.me/up
chmod a+x up

# Babushka directory
BABUSHKA_PATH="/usr/local/babushka"

expect -c "spawn ./up; expect \"Sound good?\"; send \"y\n\" ; expect
\"*Where would you like babushka installed*\"; send ${BABUSHKA_PATH}
\n; wait"
----

Is there a better way of doing this?

Cheers,
Dan

Ben Hoskings

unread,
Nov 15, 2011, 10:59:37 PM11/15/11
to babush...@googlegroups.com
Hi Dan,

I don't have time to look properly at this right now but one thing -- if you use

babushka.me/up/hard

instead, then it won't ask for any input, i.e. it installs unconditionally. I guess that means you could remove the 'send' business (but I've never used vagrant.)

- Ben

> --
> To post, email babush...@googlegroups.com
> To unsubscribe, email babushka_app...@googlegroups.com
> ~
> http://babushka.me
> http://github.com/benhoskings/babushka
> http://groups.google.com/group/babushka_app

Alan Harper

unread,
Nov 15, 2011, 11:07:19 PM11/15/11
to babush...@googlegroups.com
Also, the provision script gets called on every vagrant (reload|provision|up) cycle so it needs to no-op if babs is installed.

I'd suggest making a proper babushka provider for vagrant, so you can specify what deps to run on boot. Also when doing the same with chef/puppet you normally build these in to the base box (sidenote veewee is great for creating baseboxes)

On 16/11/2011, at 2:44 PM, dkam wrote:

Ben Hoskings

unread,
Nov 15, 2011, 11:20:53 PM11/15/11
to babush...@googlegroups.com
The script is a no-op... kind of :)

It just wraps a babushka run, so if babushka is already installed, it won't modify the system the second time around. It will re-download http://babushka.me/tarballs/babushka.tgz, though, so it's not truly a no-op.

It could be made more efficient by instead `curl`ing http://babushka.me/tarballs/LATEST and only re-running the install if the commit id differs.

In the meantime, maybe you could do a

which babushka || bash -c "`curl babushka.me/up/hard`"

?

- Ben

Dan Milne

unread,
Nov 15, 2011, 11:42:16 PM11/15/11
to babush...@googlegroups.com
Thanks guys.
Making a Vagrant provider would be the best solution. For now, I've simply made the shell provisioner:


----- https://gist.github.com/gists/1369174
#!/bin/bash

# In your Vagrant file, add a shell provisioner, pointing to this file:
#
# config.vm.provision :shell, :path => "babushka.sh"
#

# Download and chmod the Babushka installer, if it's not already installed.
which babushka || bash -c "`wget -O - babushka.me/up/hard`"
-----


Cheers,
Dan

--
Dan Milne d...@nmilne.com
http://da.nmilne.com/
http://booko.com.au/

Reply all
Reply to author
Forward
0 new messages