diff --git a/salt/modules/rh_ip.py b/salt/modules/rh_ip.py index 7b6dd490ad..f166112a83 100644 --- a/salt/modules/rh_ip.py +++ b/salt/modules/rh_ip.py @@ -632,6 +632,10 @@ def _parse_settings_eth(opts, iface_type, enabled, iface): if opt in opts: result[opt] = opts[opt] + for opt in ['ipaddrs', 'ipv6addrs']: + if opt in opts: + result[opt] = opts[opt] + if 'ipv6_autoconf' in opts: result['ipv6_autoconf'] = opts['ipv6_autoconf'] diff --git a/salt/states/network.py b/salt/states/network.py index 5741361416..3afa076228 100644 --- a/salt/states/network.py +++ b/salt/states/network.py @@ -18,14 +18,14 @@ all interfaces are ignored unless specified. .. code-block:: yaml system: - network.system: - - enabled: True - - hostname: server1.example.com - - gateway: 192.168.0.1 - - gatewaydev: eth0 - - nozeroconf: True - - nisdomain: example.com - - require_reboot: True + network.system: + - enabled: True + - hostname: server1.example.com + - gateway: 192.168.0.1 + - gatewaydev: eth0 + - nozeroconf: True + - nisdomain: example.com + - require_reboot: True eth0: network.managed: @@ -195,15 +195,31 @@ all interfaces are ignored unless specified. - network: eth4 system: - network.system: - - enabled: True - - hostname: server1.example.com - - gateway: 192.168.0.1 - - gatewaydev: eth0 - - nozeroconf: True - - nisdomain: example.com - - require_reboot: True - - apply_hostname: True + network.system: + - enabled: True + - hostname: server1.example.com + - gateway: 192.168.0.1 + - gatewaydev: eth0 + - nozeroconf: True + - nisdomain: example.com + - require_reboot: True + - apply_hostname: True + + lo: + network.managed: + - name: lo + - type: eth + - onboot: yes + - userctl: no + - ipv6_autoconf: no + - enable_ipv6: true + - ipaddrs: + - 127.0.0.1/8 + - 10.1.0.4/32 + - 10.1.0.12/32 + - ipv6addrs: + - fc00::1/128 + - fc00::100/128 .. note:: Apply changes to hostname immediately. diff --git a/salt/templates/rh_ip/rh6_eth.jinja b/salt/templates/rh_ip/rh6_eth.jinja index 23bb3b31f2..df1eccf375 100644 --- a/salt/templates/rh_ip/rh6_eth.jinja +++ b/salt/templates/rh_ip/rh6_eth.jinja @@ -12,7 +12,10 @@ {%endif%}{% if ipaddr_start %}IPADDR_START="{{ipaddr_start}}" {%endif%}{% if ipaddr_end %}IPADDR_END="{{ipaddr_end}}" {%endif%}{% if clonenum_start %}CLONENUM_START="{{clonenum_start}}" -{%endif%}{% if netmask %}NETMASK="{{netmask}}" +{%endif%}{% if ipaddrs %}{% for entry in ipaddrs %}{% set ipparts = entry.rsplit('/') -%} +IPADDR{{loop.index - 1}}="{{ipparts[0]}}" +PREFIX{{loop.index - 1}}="{{ipparts[1]}}" +{%endfor -%}{%endif%}{% if netmask %}NETMASK="{{netmask}}" {%endif%}{% if gateway %}GATEWAY="{{gateway}}" {%endif%}{% if arpcheck %}ARPCHECK="{{arpcheck}}" {%endif%}{% if mtu %}MTU="{{mtu}}" @@ -20,6 +23,7 @@ {% if ipv6_autoconf %}IPV6_AUTOCONF="{{ipv6_autoconf}}" {%endif%}{% if ipv6addr %}IPV6ADDR="{{ipv6addr}}" {%endif%}{% if ipv6gateway %}IPV6_DEFAULTGW="{{ipv6gateway}}" +{%endif%}{% if ipv6addrs %}IPV6ADDR_SECONDARIES="{{ipv6addrs | join(' ')}}" {%endif%}{%endif%}{% if srcaddr %}SRCADDR="{{srcaddr}}" {%endif%}{% if peerdns %}PEERDNS="{{peerdns}}" {%endif%}{% if peerntp %}PEERNTP="{{peerntp}}" @@ -34,4 +38,4 @@ {%endif%}{% if domain %}DOMAIN="{{ domain|join(' ') }}" {% endif %}{% for server in dns -%} DNS{{loop.index}}="{{server}}" -{% endfor -%} \ No newline at end of file +{% endfor -%}