boxes: Prevent puppet and chef from being reinstalled

This commit is contained in:
Fabio Rehm 2014-03-09 17:19:57 -03:00
parent dbb6d1f131
commit cd23804046

View file

@ -21,7 +21,9 @@ SALT=${SALT:-0}
BABUSHKA=${BABUSHKA:-0} BABUSHKA=${BABUSHKA:-0}
if [ $CHEF = 1 ]; then if [ $CHEF = 1 ]; then
# TODO: Check if Chef has been installed if $(lxc-attach -n ${CONTAINER} -- which chef-solo &>/dev/null); then
log "Chef has been installed on container, skipping"
else
log "Installing Chef" log "Installing Chef"
cat > ${ROOTFS}/tmp/install-chef.sh << EOF cat > ${ROOTFS}/tmp/install-chef.sh << EOF
#!/bin/sh #!/bin/sh
@ -29,16 +31,21 @@ curl -L https://www.opscode.com/chef/install.sh -k | sudo bash
EOF EOF
chmod +x ${ROOTFS}/tmp/install-chef.sh chmod +x ${ROOTFS}/tmp/install-chef.sh
lxc-attach -n ${CONTAINER} -- /tmp/install-chef.sh lxc-attach -n ${CONTAINER} -- /tmp/install-chef.sh
fi
else else
log "Skipping Chef installation" log "Skipping Chef installation"
fi fi
if [ $PUPPET = 1 ]; then if [ $PUPPET = 1 ]; then
if $(lxc-attach -n ${CONTAINER} -- which puppet &>/dev/null); then
log "Puppet has been installed on container, skipping"
else
log "Installing Puppet" log "Installing Puppet"
wget http://apt.puppetlabs.com/puppetlabs-release-stable.deb -O "${ROOTFS}/tmp/puppetlabs-release-stable.deb" wget http://apt.puppetlabs.com/puppetlabs-release-stable.deb -O "${ROOTFS}/tmp/puppetlabs-release-stable.deb"
lxc-attach -n ${CONTAINER} -- dpkg -i "/tmp/puppetlabs-release-stable.deb" lxc-attach -n ${CONTAINER} -- dpkg -i "/tmp/puppetlabs-release-stable.deb"
lxc-attach -n ${CONTAINER} -- apt-get update lxc-attach -n ${CONTAINER} -- apt-get update
lxc-attach -n ${CONTAINER} -- apt-get install puppet -y --force-yes lxc-attach -n ${CONTAINER} -- apt-get install puppet -y --force-yes
fi
else else
log "Skipping Puppet installation" log "Skipping Puppet installation"
fi fi