mirror of https://github.com/ansible/ansible.git
Fix interfaces_file for proper file contents (#37818)
The generated file was completely unusable by the system therefore the fix which ensures that diffing the file prior to changes and after only shows diffs Furthermore the code did not work for Python 3.6 > f.writelines(to_bytes(lines, errors='surrogate_or_strict')) E TypeError: a bytes-like object is required, not 'int' The other modifications (lambda variable renaming) is to comply with default flake8 rulespull/38030/head
parent
710db82930
commit
612d0d6634
@ -0,0 +1,6 @@
|
|||||||
|
# The loopback network interface
|
||||||
|
auto lo eth0
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
# The primary network interface
|
||||||
|
iface eth0 inet dhcp
|
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"eth0": {
|
||||||
|
"address_family": "inet",
|
||||||
|
"down": [],
|
||||||
|
"method": "dhcp",
|
||||||
|
"post-up": [],
|
||||||
|
"pre-up": [],
|
||||||
|
"up": []
|
||||||
|
},
|
||||||
|
"lo": {
|
||||||
|
"address_family": "inet",
|
||||||
|
"down": [],
|
||||||
|
"method": "loopback",
|
||||||
|
"post-up": [],
|
||||||
|
"pre-up": [],
|
||||||
|
"up": []
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
auto aggi
|
||||||
|
iface aggi inet static
|
||||||
|
hwaddress ether 22:44:77:88:D5:96
|
||||||
|
address 10.44.15.196
|
||||||
|
netmask 255.255.255.248
|
||||||
|
mtu 1500
|
||||||
|
slaves int1 int2
|
||||||
|
bond_mode 4
|
||||||
|
bond_miimon 100
|
||||||
|
bond_downdelay 200
|
||||||
|
bond_updelay 200
|
||||||
|
bond_lacp_rate slow
|
||||||
|
bond_xmit_hash_policy layer3+4
|
||||||
|
post-up /sbin/ethtool -K aggi tx off tso off
|
||||||
|
|
||||||
|
auto agge
|
||||||
|
iface agge inet manual
|
||||||
|
|
||||||
|
auto br0
|
||||||
|
iface br0 inet static
|
||||||
|
bridge_ports agge
|
||||||
|
hwaddress ether 22:44:77:88:D5:98
|
||||||
|
address 188.44.133.76
|
||||||
|
netmask 255.255.255.248
|
||||||
|
gateway 188.44.133.75
|
||||||
|
slaves ext1 ext2
|
||||||
|
bond_mode 4
|
||||||
|
bond_miimon 100
|
||||||
|
bond_downdelay 200
|
||||||
|
bond_updelay 200
|
||||||
|
bond_lacp_rate slow
|
||||||
|
bond_xmit_hash_policy layer3+4
|
||||||
|
post-up /sbin/ethtool -K agge tx off tso off
|
||||||
|
|
||||||
|
up route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi
|
||||||
|
up route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi
|
||||||
|
up route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi
|
||||||
|
|
||||||
|
auto int1
|
||||||
|
iface int1 inet manual
|
||||||
|
bond-master aggi
|
||||||
|
|
||||||
|
auto int2
|
||||||
|
iface int2 inet manual
|
||||||
|
bond-master aggi
|
||||||
|
|
||||||
|
auto ext1
|
||||||
|
iface ext1 inet manual
|
||||||
|
bond-master agge
|
||||||
|
|
||||||
|
auto ext2
|
||||||
|
iface ext2 inet manual
|
||||||
|
bond-master agge
|
||||||
|
|
||||||
|
auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
source /etc/network/interfaces.d/*.cfg
|
@ -0,0 +1,8 @@
|
|||||||
|
fail_json message: Error: interface eth0 not found
|
||||||
|
options:
|
||||||
|
{
|
||||||
|
"iface": "eth0",
|
||||||
|
"option": "mtu",
|
||||||
|
"state": "absent",
|
||||||
|
"value": "1350"
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"agge": {
|
||||||
|
"address_family": "inet",
|
||||||
|
"down": [],
|
||||||
|
"method": "manual",
|
||||||
|
"post-up": [],
|
||||||
|
"pre-up": [],
|
||||||
|
"up": []
|
||||||
|
},
|
||||||
|
"aggi": {
|
||||||
|
"address": "10.44.15.196",
|
||||||
|
"address_family": "inet",
|
||||||
|
"bond_downdelay": "200",
|
||||||
|
"bond_lacp_rate": "slow",
|
||||||
|
"bond_miimon": "100",
|
||||||
|
"bond_mode": "4",
|
||||||
|
"bond_updelay": "200",
|
||||||
|
"bond_xmit_hash_policy": "layer3+4",
|
||||||
|
"down": [],
|
||||||
|
"hwaddress": "ether 22:44:77:88:D5:96",
|
||||||
|
"method": "static",
|
||||||
|
"mtu": "1500",
|
||||||
|
"netmask": "255.255.255.248",
|
||||||
|
"post-up": [
|
||||||
|
"/sbin/ethtool -K aggi tx off tso off"
|
||||||
|
],
|
||||||
|
"pre-up": [],
|
||||||
|
"slaves": "int1 int2",
|
||||||
|
"up": []
|
||||||
|
},
|
||||||
|
"br0": {
|
||||||
|
"address": "188.44.133.76",
|
||||||
|
"address_family": "inet",
|
||||||
|
"bond_downdelay": "200",
|
||||||
|
"bond_lacp_rate": "slow",
|
||||||
|
"bond_miimon": "100",
|
||||||
|
"bond_mode": "4",
|
||||||
|
"bond_updelay": "200",
|
||||||
|
"bond_xmit_hash_policy": "layer3+4",
|
||||||
|
"bridge_ports": "agge",
|
||||||
|
"down": [],
|
||||||
|
"gateway": "188.44.133.75",
|
||||||
|
"hwaddress": "ether 22:44:77:88:D5:98",
|
||||||
|
"method": "static",
|
||||||
|
"netmask": "255.255.255.248",
|
||||||
|
"post-up": [
|
||||||
|
"/sbin/ethtool -K agge tx off tso off"
|
||||||
|
],
|
||||||
|
"pre-up": [],
|
||||||
|
"slaves": "ext1 ext2",
|
||||||
|
"up": [
|
||||||
|
"route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi",
|
||||||
|
"route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi",
|
||||||
|
"route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ext1": {
|
||||||
|
"address_family": "inet",
|
||||||
|
"bond-master": "agge",
|
||||||
|
"down": [],
|
||||||
|
"method": "manual",
|
||||||
|
"post-up": [],
|
||||||
|
"pre-up": [],
|
||||||
|
"up": []
|
||||||
|
},
|
||||||
|
"ext2": {
|
||||||
|
"address_family": "inet",
|
||||||
|
"bond-master": "agge",
|
||||||
|
"down": [],
|
||||||
|
"method": "manual",
|
||||||
|
"post-up": [],
|
||||||
|
"pre-up": [],
|
||||||
|
"up": []
|
||||||
|
},
|
||||||
|
"int1": {
|
||||||
|
"address_family": "inet",
|
||||||
|
"bond-master": "aggi",
|
||||||
|
"down": [],
|
||||||
|
"method": "manual",
|
||||||
|
"post-up": [],
|
||||||
|
"pre-up": [],
|
||||||
|
"up": []
|
||||||
|
},
|
||||||
|
"int2": {
|
||||||
|
"address_family": "inet",
|
||||||
|
"bond-master": "aggi",
|
||||||
|
"down": [],
|
||||||
|
"method": "manual",
|
||||||
|
"post-up": [],
|
||||||
|
"pre-up": [],
|
||||||
|
"up": []
|
||||||
|
},
|
||||||
|
"lo": {
|
||||||
|
"address_family": "inet",
|
||||||
|
"down": [],
|
||||||
|
"method": "loopback",
|
||||||
|
"post-up": [],
|
||||||
|
"pre-up": [],
|
||||||
|
"up": []
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue