network configuration from host_vars

This commit is contained in:
f 2022-09-03 15:18:45 -03:00
parent cfa432c4ce
commit 182ece622e

View file

@ -5,14 +5,12 @@ iface lo inet loopback
auto eth0
iface eth0 inet static
address {{ hostvars[inventory_hostname].ansible_default_ipv4.address }}
netmask {{ hostvars[inventory_hostname].ansible_default_ipv4.netmask }}
gateway {{ hostvars[inventory_hostname].ansible_default_ipv4.gateway }}
address {{ ansible_host }}/{{ netmask }}
gateway {{ gateway }}
{% if ip6 is defined %}
iface eth0 inet6 static
address {{ ip6 }}
netmask {{ netmask6 }}
address {{ ip6 }}/{{ netmask6 }}
gateway {{ gateway6 }}
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth0/accept_ra
{% endif %}