blob: 62f32e1f1a25f55148025ce2d5a5c303bfc6f0cb [file] [log] [blame]
Simon Pasquierd3a0b912017-05-02 15:32:20 +02001#!/bin/bash -x
2exec > >(tee -i /tmp/"$(basename "$0" .sh)"_"$(date '+%Y-%m-%d_%H-%M-%S')".log) 2>&1
3
4RABBITMQ_SERVICE=$(salt -C 'I@rabbitmq:server' test.ping 1>/dev/null 2>&1 && echo true)
5GALERA_SERVICE=$(salt -C 'I@galera:master or I@galera:slave' test.ping 1>/dev/null 2>&1 && echo true)
6MEMCACHED_SERVICE=$(salt -C 'I@memcached:server' test.ping 1>/dev/null 2>&1 && echo true)
7NGINX_SERVICE=$(salt -C 'I@nginx:server' test.ping 1>/dev/null 2>&1 && echo true)
8
9# Install keepaliveds
10salt -C 'I@keepalived:cluster' state.sls keepalived -b 1
11# Check the VIPs
12salt -C 'I@keepalived:cluster' cmd.run "ip a | grep 172.16.10.2"
13
14# Install gluster services
15salt -C 'I@glusterfs:server' state.sls glusterfs.server.service
16salt -C 'I@glusterfs:server' state.sls glusterfs.server.setup -b 1
17# Check the gluster status
18salt -C 'I@glusterfs:server' cmd.run "gluster peer status; gluster volume status" -b 1
19# Configure gluster clients
20salt -C 'I@glusterfs:client' state.sls glusterfs.client
21
22if [[ "$RABBITMQ_SERVICE" == "true" ]]; then
23 # Install rabbitmq
24 salt -C 'I@rabbitmq:server' state.sls rabbitmq
25 # Check the rabbitmq status
26 salt -C 'I@rabbitmq:server' cmd.run "rabbitmqctl cluster_status"
27fi
28
29if [[ "$GALERA_SERVICE" == "true" ]]; then
30 # Install galera
31 salt -C 'I@galera:master' state.sls galera
32 salt -C 'I@galera:slave' state.sls galera
33 # Check galera status
34 salt -C 'I@galera:master' mysql.status | grep -A1 wsrep_cluster_size
35 salt -C 'I@galera:slave' mysql.status | grep -A1 wsrep_cluster_size
36fi
37
38# Install haproxy
39salt -C 'I@haproxy:proxy' state.sls haproxy
40salt -C 'I@haproxy:proxy' service.status haproxy
41salt -I 'haproxy:proxy' service.restart rsyslog
42
43if [[ "$MEMCACHED_SERVICE" == "true" ]]; then
44 # Install memcached
45 salt -C 'I@memcached:server' state.sls memcached
46fi
47
48if [[ "$NGINX_SERVICE" == "true" ]]; then
49 # Install memcached
50 salt -C 'I@nginx:server' state.sls nginx
51fi