Merge "mcp: openstack: Install & configure horizon"
[fuel.git] / mcp / scripts / salt.sh
1 #!/bin/bash
2 #
3 # Deploy Salt Master
4 #
5
6 # ssh to cfg01
7 ssh ${SSH_OPTS} ubuntu@${SALT_MASTER} bash -s << SALT_INSTALL_END
8   sudo -i
9
10   echo -n 'Checking out cloud-init has finished running ...'
11   while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo -n '.'; sleep 1; done
12   echo ' done'
13
14   apt-get install -y git curl subversion
15
16   svn export --force https://github.com/salt-formulas/salt-formulas/trunk/deploy/scripts /srv/salt/scripts
17   git clone --depth=1 --recurse-submodules https://git.opnfv.org/fuel
18   ln -s /root/fuel/mcp/reclass /srv/salt/reclass
19
20   mkdir -p /usr/share/salt-formulas/reclass
21   cp -r /root/fuel/mcp/metadata/service /usr/share/salt-formulas/reclass
22   cd /srv/salt/reclass/classes/service && ln -s /usr/share/salt-formulas/reclass/service/opendaylight
23   cd /root/fuel/mcp/patches && ./patch.sh patches.list reclass
24
25   cd /srv/salt/scripts
26   MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} DISTRIB_REVISION=nightly ./salt-master-init.sh
27   salt-key -Ay
28
29   cp -r /root/fuel/mcp/salt-formulas/* /usr/share/salt-formulas/env
30   cd /root/fuel/mcp/patches && ./patch.sh patches.list formulas
31
32   salt-call state.apply salt
33   salt '*' state.apply salt | fgrep -q 'No response' && salt '*' state.apply salt
34
35   salt -C 'I@salt:master' state.sls linux
36   salt -C '* and not cfg01*' state.sls linux
37
38   salt '*' state.sls ntp
39 SALT_INSTALL_END