From 555c3df42fcab65c1a3d3ea1fc17189df2228042 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sat, 8 Jul 2017 18:25:40 -0700 Subject: [PATCH 1/2] Separate the netmask out of eth_local_ip_address --- roles/dhcp-server/defaults/main.yml | 3 ++- roles/dhcp-server/templates/interfaces-dhcp.j2 | 2 +- roles/dhcp-server/templates/interfaces-static.j2 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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 From 6be74a60a64d38fc7e7030a8541e4fa21e6aac1c Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sat, 8 Jul 2017 18:25:52 -0700 Subject: [PATCH 2/2] The NFS server should listen on the local network Not whatever network ansible thinks is default --- roles/nfs-server/templates/exports.j2 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 %}