26 lines
532 B
Bash
26 lines
532 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
log_msg() {
|
||
|
echo -e "[ ${HOSTNAME} ] [ $(date -u +"%Y-%m-%dT%H:%M:%SZ") ] $@" >&2;
|
||
|
}
|
||
|
|
||
|
|
||
|
log_msg "Installing consul";
|
||
|
sudo apt-get update;
|
||
|
sudo apt-get install --yes hashicorp-consul;
|
||
|
|
||
|
log_msg "consul installed successfully. Version:";
|
||
|
consul --version;
|
||
|
|
||
|
log_msg "Creating directories";
|
||
|
if [[ ! -d "/etc/consul" ]]; then
|
||
|
sudo mkdir /etc/consul;
|
||
|
sudo chown root:root /etc/consul;
|
||
|
fi
|
||
|
|
||
|
if [[ ! -d "/srv/consul" ]]; then
|
||
|
sudo mkdir /srv/consul;
|
||
|
sudo chown root:root /srv/consul;
|
||
|
sudo chmod 0750 /srv/consul;
|
||
|
fi
|