]> granicus.if.org Git - icinga2/commitdiff
Refactor vm bootstrapping
authorJohannes Meyer <johannes.meyer@netways.de>
Tue, 10 Dec 2013 08:27:04 +0000 (09:27 +0100)
committerJohannes Meyer <johannes.meyer@netways.de>
Mon, 16 Dec 2013 14:37:38 +0000 (15:37 +0100)
refs #5223

test/jenkins/bootstrap-vm.sh

index 30d8f5d31870ed40d12d5867a5aa5466157640d1..586938d5de4cdddf8fc390f279bdf3b5d9be07ca 100755 (executable)
@@ -1,14 +1,29 @@
 #!/bin/sh
-if [ "$1" != "run-by-jenkins" ]; then
-       echo "This script should not be run manually."
+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
 
-echo "10.10.27.1 packages.icinga.org" >> /etc/hosts
+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"
 
-groupadd vagrant
+$SSH "mkdir -p /tmp/icinga2/puppet-stuff"
+scp -r ../../.vagrant-puppet $user@$host:/tmp/icinga2/puppet-stuff
 
-rmdir /vagrant && ln -s /root/icinga2 /vagrant
-puppet apply --modulepath=/vagrant/.vagrant-puppet/modules /vagrant/.vagrant-puppet/manifests/default.pp
+$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