Use a REGEX to detect if the public IP is WISP network

This commit is contained in:
Keith Whyte 2021-09-15 21:35:54 +02:00
parent 2e6297c11d
commit 127fd0f3ad
2 changed files with 2 additions and 2 deletions

View file

@ -90,7 +90,7 @@ class rhizo_base {
$ssh_addr = hiera('rhizo::ssh_t_address','127.0.0.1') $ssh_addr = hiera('rhizo::ssh_t_address','127.0.0.1')
$ssh_user = hiera('rhizo::ssh_user','') $ssh_user = hiera('rhizo::ssh_user','')
$ssh_p = split($vpn_ip_address, '\.')[3] $ssh_p = split($vpn_ip_address, '\.')[3]
$protokol_pub_ip = hiera('rhizo::protokol_pub_ip','') $proto_pub_ip_regex = hiera('rhizo::proto_pub_ip_regex','^0.0.0.0$')
$stats_disk = hiera('rhizo::stats_disk','sda1') $stats_disk = hiera('rhizo::stats_disk','sda1')
$stats_if = hiera('rhizo::stats_if','eth0') $stats_if = hiera('rhizo::stats_if','eth0')

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
_IP=`curl -s api.ipify.org` _IP=`curl -s api.ipify.org`
echo $_IP > /tmp/my_ip echo $_IP > /tmp/my_ip
if [ "$_IP" == "<%= @protokol_pub_ip %>" ] ;then if [[ $_IP =~ <%= @proto_pub_ip_regex %> ]] ;then
_IP=`curl -s 10.0.200.100/ip.sh` _IP=`curl -s 10.0.200.100/ip.sh`
echo $_IP >> /tmp/my_ip echo $_IP >> /tmp/my_ip
fi fi