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