icinga2/test/jenkins/bootstrap-vm.sh

30 lines
774 B
Bash
Raw Normal View History

#!/bin/sh
2013-12-10 09:27:04 +01:00
if [ "$1" != "--force" ]; then
echo 'This script is NOT intended to be ran by an individual user.' \
'If you are not human, pass "--force" as the first option to it!'
exit 1
fi
2013-12-10 09:27:04 +01:00
if [ $# -lt 3 ]; then
echo 'Too few arguments. You need to pass "--force <user> <host>"' \
'to run this script.'
exit 1
fi
user=$2
host=$3
SSH_OPTIONS="-o PasswordAuthentication=no"
SSH="ssh $SSH_OPTIONS $user@$host"
2013-12-10 09:27:04 +01:00
$SSH "mkdir -p /tmp/icinga2/puppet-stuff"
scp -r ../../.vagrant-puppet $user@$host:/tmp/icinga2/puppet-stuff
2013-12-10 09:27:04 +01:00
$SSH "groupadd vagrant"
$SSH "echo '10.10.27.1 packages.icinga.org' >> /etc/hosts"
$SSH "puppet apply --modulepath=/tmp/icinga2/puppet-stuff/modules" \
" /tmp/icinga2/puppet-stuff/manifests/default.pp"
exit 0