#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.

{% set head_host = groups['head'][0] -%}
{% set head_ip = hostvars[head_host]['ansible_default_ipv4']['address'] -%}
{% set virt_network = virt_nets[0]['ipv4_prefix'] ~ '.0' -%}
{% set virt_netmask = "255.255.255.0" -%}

route add -net {{ virt_network }} netmask {{ virt_netmask }} gw {{ head_ip }} || true

exit 0
