Merge pull request #30491 from jacksontj/2015.8

Add multi-IP support to network state
This commit is contained in:
Mike Place 2016-01-21 08:51:42 -07:00
commit d8d19cf75d
3 changed files with 43 additions and 19 deletions

View File

@ -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']

View File

@ -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.

View File

@ -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 -%}
{% endfor -%}