This commit is contained in:
Ariel Sosnovsky committed 2024-02-07 15:05:22 -05:00
1 parent 631baab06b
commit 125a75629c
5 files changed
+24 -10

No files matched your search

+4 -1
View File
@@ -47,4 +47,7 @@ iot:
- name: 'apollo-eddie'
mac: '30:30:F9:DC:A8:18'
- name: 'apollo-office'
mac: '30:30:F9:DA:C7:A4'
mac: '30:30:F9:DA:C7:A4'
apl:
- name: 'hp-print'
mac: '48:9E:BD:CB:07:E3'
+1
View File
@@ -20,6 +20,7 @@ ip_prefix_map = {
"hub": "10.0.12.",
"cam": "10.0.13.",
"iot": "10.0.14.",
"apl": "10.0.15."
}
def cap1_and_join(*args: str) -> str:
@@ -48,3 +48,5 @@ dhcp-host=30:30:F9:DC:A8:18,IotApollo-eddie,10.0.14.4,infinite
address=/apollo-eddie.iot.internal/10.0.14.4
dhcp-host=30:30:F9:DA:C7:A4,IotApollo-office,10.0.14.5,infinite
address=/apollo-office.iot.internal/10.0.14.5
dhcp-host=48:9E:BD:CB:07:E3,AplHp-print,10.0.15.1,infinite
address=/hp-print.apl.internal/10.0.15.1
+5 -1
View File
@@ -68,4 +68,8 @@ Iot:
host: "apollo-eddie.iot.internal"
Apollo-office:
ip: "10.0.14.5"
host: "apollo-office.iot.internal"
host: "apollo-office.iot.internal"
Apl:
Hp-print:
ip: "10.0.15.1"
host: "hp-print.apl.internal"
+12 -8
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
BASE_PATH=$(realpath $BASH_SOURCE | xargs dirname)
BASE_PATH=$(realpath "${BASH_SOURCE[0]}" | xargs dirname)
ROUTER=${1:-10.0.0.1}
USER=${2:-root}
@@ -23,17 +23,17 @@ function ask {
server=$USER@$ROUTER
echo "using 🤖 $server"
pushd $BASE_PATH
pushd "$BASE_PATH" || exit 1
echo "Updating conf..."
./gen-mappings.py
cat output/summary.yaml
ask
ask "continue update"
scp -O output/etc/dnsmasq.conf $USER@$ROUTER:/tmp/dnsmasq.new.conf
ssh $USER@$ROUTER << EOF
echo "Backing up dnsmasq.conf file to /tmp/dnsmasq.old.conf"
scp -O output/etc/dnsmasq.conf "$server:/tmp/dnsmasq.new.conf"
ssh "$server" << EOF
echo 'Backing up dnsmasq.conf file to /tmp/dnsmasq.old.conf'
cp /etc/dnsmasq.conf /tmp/dnsmasq.old.conf
echo "Updating dnsmasq.conf 🙇🏼"
echo 'Updating dnsmasq.conf 🙇🏼'
cp /tmp/dnsmasq.new.conf /etc/dnsmasq.conf
if dnsmasq --test ; then
/etc/init.d/dnsmasq restart
@@ -44,4 +44,8 @@ else
dnsmasq --test
echo "Revert successful! 👍"
fi
EOF
EOF
git add .
git commit -m "Updated Router Config at $(date)"
git push