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'] -%} |
| 14 | {% set virt_network = hostvars[head_host]['ansible_virbr0']['ipv4']['network'] -%} |
| 15 | {% set virt_netmask = hostvars[head_host]['ansible_virbr0']['ipv4']['netmask'] -%} |
| 16 | |
| 17 | route add -net {{ virt_network }} netmask {{ virt_netmask }} gw {{ head_ip }} || true |
| 18 | |
| 19 | exit 0 |