-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply
executable file
·31 lines (27 loc) · 1.05 KB
/
apply
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Usage: curl https://raw.github.com/nuada/puppet/master/apply | bash -s
# Install puppet
if [[ ! $(which puppet) ]]; then
. /etc/lsb-release
wget http://apt.puppetlabs.com/puppetlabs-release-${DISTRIB_CODENAME}.deb
dpkg -i puppetlabs-release-${DISTRIB_CODENAME}.deb
rm -rf puppetlabs-release-${DISTRIB_CODENAME}.deb
apt-get update
apt-get -y install puppet
fi
if [[ ! $(puppet module list | grep puppetlabs-apt) ]]; then
puppet module install puppetlabs/apt
fi
# If not running from repo clone it
if [[ $0 == 'bash' ]]; then
if [[ ! $(dpkg -l git-core 2> /dev/null) ]]; then
apt-get install -qqy git-core
fi
git clone https://github.com/nuada/puppet
cd puppet
fi
export FACTER_default_user=${SUDO_USER}
export FACTER_default_user_home=$(getent passwd ${SUDO_USER} | cut -d : -f 6)
export FACTER_default_user_fullname=$(getent passwd nuada | cut -d : -f 5 | cut -d , -f 1)
export FACTER_default_user_email=$(getent passwd nuada | cut -d : -f 5 | cut -d , -f 4)
puppet apply --verbose --modulepath=/etc/puppet/modules:modules $* manifests/site.pp