diff --git a/roles/dhcp-server/defaults/main.yml b/roles/dhcp-server/defaults/main.yml index e9a9d30..a8b0287 100644 --- a/roles/dhcp-server/defaults/main.yml +++ b/roles/dhcp-server/defaults/main.yml @@ -1,5 +1,6 @@ --- -eth_local_ip_address: 10.20.0.1/24 +eth_local_ip_address: 10.20.0.1 +eth_local_ip_netmask: 24 eth_local_mac_address: 00:00:00:00:00:01 eth_uplink_mac_address: 00:00:00:00:00:02 diff --git a/roles/dhcp-server/templates/interfaces-dhcp.j2 b/roles/dhcp-server/templates/interfaces-dhcp.j2 index 4b9b454..8799625 100644 --- a/roles/dhcp-server/templates/interfaces-dhcp.j2 +++ b/roles/dhcp-server/templates/interfaces-dhcp.j2 @@ -8,7 +8,7 @@ iface lo inet loopback auto eth-local iface eth-local inet static - address {{ eth_local_ip_address }} + address {{ eth_local_ip_address }}/{{ eth_local_ip_netmask }} pre-up ethtool -K $IFACE gso off gro off tso off || true auto eth-uplink diff --git a/roles/dhcp-server/templates/interfaces-static.j2 b/roles/dhcp-server/templates/interfaces-static.j2 index be9eb51..aeb07ea 100644 --- a/roles/dhcp-server/templates/interfaces-static.j2 +++ b/roles/dhcp-server/templates/interfaces-static.j2 @@ -8,7 +8,7 @@ iface lo inet loopback auto eth-local iface eth-local inet static - address {{ eth_local_ip_address }} + address {{ eth_local_ip_address }}/{{ eth_local_ip_netmask }} pre-up ethtool -K $IFACE gso off gro off tso off || true auto eth-uplink diff --git a/roles/nfs-server/templates/exports.j2 b/roles/nfs-server/templates/exports.j2 index e7feb79..67a0d62 100644 --- a/roles/nfs-server/templates/exports.j2 +++ b/roles/nfs-server/templates/exports.j2 @@ -1,4 +1,9 @@ # {{ ansible_managed }} # fsid=X is needed for XFS filesystems with 64bit inodes -/srv/{{ nfs_server }}/veyepar {{ eth_local_ip_address|default(ansible_default_ipv4.network + '/' + ansible_default_ipv4.netmask) }}(ro,sync,no_subtree_check,fsid=0) -/srv/{{ nfs_server }}/video {{ eth_local_ip_address|default(ansible_default_ipv4.network + '/' + ansible_default_ipv4.netmask) }}(rw,sync,no_subtree_check,fsid=1) +{% if eth_local_ip_address is defined %} +/srv/{{ nfs_server }}/veyepar {{ eth_local_ip_address }}/{{ eth_local_ip_netmask }}(ro,sync,no_subtree_check,fsid=0) +/srv/{{ nfs_server }}/video {{ eth_local_ip_address }}/{{ eth_local_ip_netmask }}(rw,sync,no_subtree_check,fsid=1) +{% else %} +/srv/{{ nfs_server }}/veyepar {{ default(ansible_default_ipv4.network + '/' + ansible_default_ipv4.netmask) }}(ro,sync,no_subtree_check,fsid=0) +/srv/{{ nfs_server }}/video {{ default(ansible_default_ipv4.network + '/' + ansible_default_ipv4.netmask) }}(rw,sync,no_subtree_check,fsid=1) +{% endif %}