add ranged interface support for bond and fix typo on rh6_eth.jinja

This commit is contained in:
cxfcxf 2015-02-11 22:21:17 -08:00
parent dc07c023cf
commit ef589559ee
2 changed files with 25 additions and 3 deletions

View File

@ -38,6 +38,27 @@ all interfaces are ignored unless specified.
- 8.8.8.8
- 8.8.4.4
eth0-range0:
network.managed:
- type: eth
- ipaddr_start: 192.168.1.1
- ipaddr_end: 192.168.1.10
- clonenum_start: 10
- mtu: 9000
bond0-range0:
network.managed:
- type: eth
- ipaddr_start: 192.168.1.1
- ipaddr_end: 192.168.1.10
- clonenum_start: 10
- mtu: 9000
.. note::
add support for ranged interfaces (bond and eth) for redhat system,
currently not support vlan and type must be eth.
routes:
network.routes:
- name: eth0
@ -292,11 +313,13 @@ def managed(name, type, enabled=True, **kwargs):
ret['comment'] = 'Bond interface {0} ' \
'added.'.format(name)
ret['changes']['bond'] = 'Added bond {0}.'.format(name)
apply_ranged_setting = True
elif old != new:
diff = difflib.unified_diff(old, new, lineterm='')
ret['comment'] = 'Bond interface {0} ' \
'updated.'.format(name)
ret['changes']['bond'] = '\n'.join(diff)
apply_ranged_setting = True
except AttributeError as error:
#TODO Add a way of reversing the interface changes.
ret['result'] = False

View File

@ -1,5 +1,5 @@
{% if "range" not in name %}DEVICE="{{name}}"
{%endif}{% if addr %}HWADDR="{{addr}}"
{%endif%}{% if addr %}HWADDR="{{addr}}"
{%endif%}{% if userctl %}USERCTL="{{userctl}}"
{%endif%}{% if master %}MASTER="{{master}}"
{%endif%}{% if slave %}SLAVE="{{slave}}"
@ -32,5 +32,4 @@
{%endif%}{% if domain %}DOMAIN="{{ domain|join(' ') }}"
{% endif %}{% for server in dns -%}
DNS{{loop.index}}="{{server}}"
{% endfor -%}
{% endfor -%}