test_gretunnel_source_gw_target_bb.j2 873 B

1234567891011121314151617
  1. #!/bin/sh
  2. # Script zum Prüfen der Tunnel von Gateway-Servern zu den Backbone-Servern per ICMP Ping
  3. failed=0
  4. echo
  5. {% for host in groups['gateways'] %}
  6. {% if 'ffms_tun_to' in hostvars[host] %}
  7. {% for link in hostvars[host].ffms_tun_to%}
  8. {% if 'host_name' in link and link.host_name == inventory_hostname %}
  9. ip=192.168.{{domaenen_id*10 + hostvars[host].server_id}}.{{server_id*4+1}}
  10. ping -c1 $ip >/dev/null 2>&1 && echo Tunnel ok: Von {{inventory_hostname}} zu {{host}}/$ip ||{ echo Tunnel failed: Von {{inventory_hostname}} zu {{host}}/$ip && failed=1;}
  11. ip=2a03:2260:115:ffa0:{{domaenen_id}}:{{hostvars[host].server_id}}:{{server_id}}:1
  12. ping6 -c1 $ip >/dev/null 2>&1 && echo Tunnel ok: Von {{inventory_hostname}} zu {{host}}/$ip ||{ echo Tunnel failed: Von {{inventory_hostname}} zu {{host}}/$ip && failed=1;}
  13. {% endif %}
  14. {% endfor %}
  15. {% endif %}
  16. {% endfor %}
  17. exit $failed