#!/usr/bin/env bash


task_begin "Installing Consul configuration";
# /etc/consul is created by the apt postinstall script

subtask_begin "Copying configuration files";
cp "configs/consul-client.hcl" "/etc/consul/client.hcl";
cp "configs/consul-server.hcl" "/etc/consul/server.hcl";
subtask_end "$?";

# No UFW rules required, as we're now using wesher/wireguard, and allowing all inbound traffic on that interface

subtask_begin "Starting Consul and enabling on boot";
systemctl enable --now consul;
subtask_end "$?";

task_end "$?";