Adds workflows to deploy and clean hosts
[pharos-tools.git] / laas-fog / install.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright 2017 Parker Berberian and Others                                 #
4 #                                                                            #
5 # Licensed under the Apache License, Version 2.0 (the "License");            #
6 # you may not use this file except in compliance with the License.           #
7 # You may obtain a copy of the License at                                    #
8 #                                                                            #
9 #    http://www.apache.org/licenses/LICENSE-2.0                              #
10 #                                                                            #
11 # Unless required by applicable law or agreed to in writing, software        #
12 # distributed under the License is distributed on an "AS IS" BASIS,          #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 # See the License for the specific language governing permissions and        #
15 # limitations under the License.                                             #
16 ##############################################################################
17
18 #installs deps 
19 if which apt ; then
20     apt update && apt -y upgrade
21     apt -y install libvirt-dev curl gcc libsas12-dev python-dev libldap2-dev libssl-dev
22 elif which yum ; then
23     yum -y update
24     yum -y install curl libvirt-devel gcc python-devel openldap-devel
25 else
26     echo "Can only run on ubuntu or centos. exiting"
27     exit 1
28 fi
29 #run their install script
30 curl -sSL https://stackstorm.com/packages/install.sh | bash -s -- --user=st2admin --password='admin'
31 #change ssh user to root
32 sed -i 's/user = stanley/user = root/' /etc/st2/st2.conf
33 sed -i 's/ssh_key_file = \/home\/stanley\/.ssh\/stanley_rsa/ssh_key_file = \/root\/.ssh\/id_rsa/' /etc/st2/st2.conf
34
35 mv pharoslab/ /opt/stackstorm/packs/
36 cp /opt/stackstorm/packs/pharoslab/pharoslab.yaml.example /opt/stackstorm/configs
37
38 echo "stackstorm should now be installed. Please edit /opt/stackstorm/configs/pharoslab.yaml and /opt/stackstorm/packs/pharoslab/hosts.json appropriately and run the setup script"