42 lines
1 KiB
Makefile
42 lines
1 KiB
Makefile
# Always use devbox environment to run commands.
|
|
set shell := ["devbox", "run"]
|
|
# Load dotenv
|
|
set dotenv-load
|
|
|
|
default:
|
|
@just --list
|
|
|
|
lint:
|
|
@tofu fmt -check -recursive .
|
|
@tflint --recursive
|
|
|
|
deploy:
|
|
#!/usr/bin/env sh
|
|
cd {{justfile_directory()}}/terraform
|
|
tofu init
|
|
tofu apply
|
|
|
|
destroy:
|
|
#!/usr/bin/env sh
|
|
cd {{justfile_directory()}}/terraform
|
|
tofu destroy
|
|
|
|
deploy-config node ipv4_subnet ipv6_subnet:
|
|
#!/usr/bin/env sh
|
|
echo "Configuring {{node}}.network.tjo.cloud"
|
|
echo " - IPv4: {{ipv4_subnet}}"
|
|
echo " - IPv6: {{ipv6_subnet}}"
|
|
|
|
for file in {{justfile_directory()}}/openwrt/etc/config/*
|
|
do
|
|
echo "Deploying /etc/config/$(basename $file)"
|
|
export IPV4_SUBNET="{{ipv4_subnet}}"
|
|
export IPV6_SUBNET="{{ipv6_subnet}}"
|
|
export HOSTNAME="{{node}}.network.tjo.cloud"
|
|
cat $file | envsubst | tailscale ssh "root@{{node}}-network-tjo-cloud" "cat > /etc/config/$(basename $file)"
|
|
done
|
|
|
|
echo "Reboot router in 5 seconds..."
|
|
sleep 5
|
|
echo "Rebooting router..."
|
|
tailscale ssh "root@{{node}}-network-tjo-cloud" "reboot"
|