Created
August 26, 2010 07:50
-
-
Save jfqd/551020 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# (c) 2010 S. Husch | qutic development | |
# postflight init script after zone installation | |
# Make sure only root can run this script | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
if [ -d /var/lib/puppet ] | |
then | |
echo "Puppet bootstrap already done! exit." | |
exit 0 | |
else | |
echo "Starting puppet bootstrap" | |
fi | |
# create puppet library folder | |
/usr/bin/mkdir -p /var/lib/puppet | |
# fix nexenta npc 3.0 zone issue (http://www.nexenta.org/issues/173#note-5) | |
/usr/sbin/pwconv | |
/usr/sbin/dpkg-reconfigure sunwcsd | |
/usr/sbin/svccfg import /var/svc/manifest/system/sysevent.xml | |
# install ruby | |
echo "Installing ruby..." 1>&2 | |
/usr/bin/apt-get install --yes --force-yes ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 | |
/usr/bin/apt-get install --yes --force-yes libreadline-ruby1.8 libruby1.8 | |
/usr/bin/apt-get install --yes --force-yes libopenssl-ruby sqlite3 libsqlite3-ruby1.8 | |
/usr/bin/ln -s /usr/bin/ruby1.8 /usr/bin/ruby | |
/usr/bin/ln -s /usr/bin/ri1.8 /usr/bin/ri | |
/usr/bin/ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc | |
/usr/bin/ln -s /usr/bin/irb1.8 /usr/bin/irb | |
# install rubygems | |
echo "Installing rubygems..." 1>&2 | |
/usr/bin/wget -q http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz | |
/usr/sbin/tar xzf rubygems-1.3.7.tgz | |
cd rubygems-1.3.7 | |
/usr/bin/ruby setup.rb | |
cd .. | |
/usr/bin/rm -rf rubygems-1.3.7 | |
/usr/bin/ln -s /usr/bin/gem1.8 /usr/bin/gem | |
/usr/bin/gem update | |
/usr/bin/gem update --system | |
/usr/bin/gem install rake | |
echo "Installing puppet client..." 1>&2 | |
/usr/bin/gem install puppet | |
/usr/sbin/groupadd puppet | |
/usr/sbin/useradd -g puppet puppet | |
/usr/bin/mkdir -p /etc/puppet/ | |
/usr/bin/mkdir -p /var/svc/manifest/network/puppet/ | |
/usr/bin/wget -q -O /var/svc/manifest/network/puppet/client.xml http://gist.github.com/raw/540939/64fe02724bcd976e2fa18d574633cd9dbcfebd0d/client.xml | |
/usr/bin/chown root:sys /var/svc/manifest/network/puppet/client.xml | |
/usr/bin/chmod 444 /var/svc/manifest/network/puppet/client.xml | |
/usr/sbin/svccfg import /var/svc/manifest/network/puppet/client.xml | |
# configure puppet, create puppet.conf file | |
# domainname=`/usr/bin/domainname` | |
/usr/bin/cat <<EOF > "/etc/puppet/puppet.conf" | |
[agent] | |
report=true | |
verbose=true | |
debug=true | |
server=puppetmaster | |
EOF | |
# start puppet client | |
/usr/bin/chmod 644 "/etc/puppet/puppet.conf" | |
/usr/sbin/svcadm enable svc:/network/puppet/client:default | |
/usr/bin/svcs puppet/client | |
echo "Bootstrap done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// Bootstrap script for running a puppet-client in a nexenta ncp 3 zone