Skip to content

Instantly share code, notes, and snippets.

@sandfox
Created September 8, 2012 18:11
Show Gist options
  • Save sandfox/3678190 to your computer and use it in GitHub Desktop.
Save sandfox/3678190 to your computer and use it in GitHub Desktop.
Jenkins Slave set-up script
#!/bin/bash
# Initialize ephemeral storage
curl https://raw.github.com/gist/3678190/ephemeral > /etc/init.d/ephemeral
chmod +x /etc/init.d/ephemeral
ln -s ../init.d/ephemeral /etc/rcS.d/S10ephemeral
/etc/init.d/ephemeral
ln -s /mnt/jenkins /var/jenkins
ln -s /mnt/tmp /tmp
apt-get update
apt-get install -y git build-essential php5-cli php-pear php5-dev php5-xdebug php5-xsl
pear config-set auto_discover 1
# User-level setup
useradd -k /etc/skel -m -s /bin/bash jenkins
mkdir /home/jenkins/.ssh
cp /home/ubuntu/.ssh/authorized_keys /home/jenkins/.ssh/authorized_keys
chown -R jenkins:jenkins /home/jenkins/.ssh
chmod 700 /home/jenkins/.ssh
chmod 600 /home/jenkins/.ssh/authorized_keys
curl https://raw.github.com/gist/3678190/sudoers.wheel >> /etc/sudoers
groupadd wheel
usermod -G wheel jenkins
mkdir -p /var/jenkins/workspace
chown -R jenkins:jenkins /var/jenkins
#!/bin/bash
# As user jenkins ( via `sudo su - jenkins` ):
sudo su -l jenkins
ssh-keygen -q -t rsa -b 4096 -N "" -f .ssh/id_rsa
curl https://raw.github.com/gist/3678190/bash_login.jenkins > /home/jenkins/.bash_login
mv /home/jenkins/.bashrc /home/jenkins/.bashrc~
curl https://raw.github.com/gist/3678190/ssh_config >> /home/jenkins/.ssh/config
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
#!/bin/sh
# Initialize ephemeral storage on /mnt
mkdir -p /mnt/jenkins/workspace
chown -R jenkins:jenkins /mnt/jenkins
mkdir -p /mnt/tmp
chmod 1777 /mnt/tmp
Host bitbucket.org
StrictHostKeyChecking no
Host heroku.com
StrictHostKeyChecking no
%wheel ALL=(ALL) NOPASSWD: ALL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment