diff --git a/modules/rhizo_base/manifests/init.pp b/modules/rhizo_base/manifests/init.pp index 8a4daa4..048e736 100644 --- a/modules/rhizo_base/manifests/init.pp +++ b/modules/rhizo_base/manifests/init.pp @@ -84,6 +84,7 @@ class rhizo_base { $ssh_addr = hiera('rhizo::ssh_t_address','127.0.0.1') $ssh_user = hiera('rhizo::ssh_user','') $ssh_p = split($vpn_ip_address, '\.')[3] + $protokol_pub_ip = hiera('rhizo::protokol_pub_ip','') $stats_disk = hiera('rhizo::stats_disk','sda1') $stats_if = hiera('rhizo::stats_if','eth0') @@ -275,6 +276,12 @@ schedule { 'never': purge => false, } + file { '/home/rhizomatica/bin/get_ip.sh': + ensure => present, + content => template('rhizo_base/get_ip.sh.erb'), + group => 'rhizomatica' + } + file { '/home/rhizomatica/bin/monitor_amp.sh': ensure => present, source => "puppet:///modules/rhizo_base/monitor_amp.sh.${bts_amps}", diff --git a/modules/rhizo_base/templates/get_ip.sh.erb b/modules/rhizo_base/templates/get_ip.sh.erb new file mode 100755 index 0000000..c8a131b --- /dev/null +++ b/modules/rhizo_base/templates/get_ip.sh.erb @@ -0,0 +1,7 @@ +#!/bin/bash +_IP=`curl -s api.ipify.org` +echo $_IP > /tmp/my_ip +if [ "$_IP" == "<%= @protokol_pub_ip %>" ] ;then + _IP=`curl -s 10.0.200.100/ip.sh` + echo $_IP >> /tmp/my_ip +fi diff --git a/modules/rhizo_base/templates/rhizomatica.cron.erb b/modules/rhizo_base/templates/rhizomatica.cron.erb index 26abb2a..ed6e6a5 100644 --- a/modules/rhizo_base/templates/rhizomatica.cron.erb +++ b/modules/rhizo_base/templates/rhizomatica.cron.erb @@ -79,6 +79,7 @@ PYTHONPATH=$PYTHONPATH:/var/rhizomatica/rccn # It's a new day.... 30 5 * * * root /home/rhizomatica/bin/check_broken.sh + 31 5 * * * root /home/rhizomatica/bin/get_ip.sh # Jobs to run on the BTS 15 3 * * * root /var/SysmoBTS/maint.sh