Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 1 | #!/bin/sh -e |
| 2 | # |
| 3 | # rc.local |
| 4 | # |
| 5 | # This script is executed at the end of each multiuser runlevel. |
| 6 | # Make sure that the script will "exit 0" on success or any other |
| 7 | # value on error. |
| 8 | # |
| 9 | # In order to enable or disable this script just change the execution |
| 10 | # bits. |
| 11 | |
| 12 | {% set head_host = groups['head'][0] -%} |
| 13 | {% set head_ip = hostvars[head_host]['ansible_default_ipv4']['address'] -%} |
Zack Williams | da06358 | 2016-04-12 14:02:47 -0700 | [diff] [blame] | 14 | {% set virt_network = virt_nets[0]['ipv4_prefix'] ~ '.0' -%} |
| 15 | {% set virt_netmask = "255.255.255.0" -%} |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 16 | |
| 17 | route add -net {{ virt_network }} netmask {{ virt_netmask }} gw {{ head_ip }} || true |
| 18 | |
| 19 | exit 0 |