У меня проблема с несогласованным отступом в конфигурации netplan. Я бы хотел, чтобы, если возможно, кто-нибудь объяснил мне, в чем я ошибаюсь. Спасибо.
Ошибка:
/etc/netplan/50-cloud-init.yaml:**46**:12: Invalid YAML: inconsistent indentation:
addresses: []
От этой строки до конца двух последних конфигураций VLAN (eno3.220 и eno3.230) все считается ошибкой.
Конфигурация netplan следующая следующее:
network:
version: 2
ethernets:
eno1:
{}
eno2:
{}
eno3:
{}
eno4:
{}
bonds:
bond0:
interfaces: [eno1, eno2]
addresses: []
parameters:
mode: balance-alb
mii-monitor-interval: 1
gratuitious-arp: 5
primary: eno1
optional: false
vlans:
bond0.640:
addresses: []
dhcp4: false
id: 640
link: bond0
bond0.1008:
addresses: []
dhcp4: false
id: 1008
link: bond0
eno3.220:
addresses: [] «-- **line 46**
dhcp4: false
id: 220
link: eno3
eno3.230:
addresses: []
dhcp4: false
id: 230
link: eno3
bridges:
br0:
interfaces: [bond0.1008]
addresses: [ x.x.x.x/x ]
dhcp4: false
gateway4: x.x.x.1
parameters:
forward-delay: 0
nameservers:
addresses: [ x.x.x.x, y.y.y.y ]
search: []
optional: false
br1:
interfaces: [bond0.640] «--- inactive at this moment
#addresses: [ ]
dhcp4: false
#gateway4:
parameters:
forward-delay: 0
#nameservers:
#addresses: [ ]
search: []
optional: false
br2:
interfaces: [eno3.220]
dhcp4: false
addresses: [x.x.x.x/x]
gateway4: x.x.x.1
parameters:
forward-delay: 0
nameservers:
addresses: [x.x.x.x, y.y.y.y]
search: []
optional: false
br3:
interfaces: [eno3.230] «-- inactive at this moment
#addresses: []
dhcp4: false
#gateway4:
parameters:
forward-delay: 0
#nameservers:
#addresses: []
#search: []
optional: false
У вас много ошибок .yaml...netplan очень привередлив в отношении пробелов, отступов (должно быть только 2 пробела), отсутствия вкладок...
Примечание: установите yamllint
для проверки файлов .yaml.
sudo apt-get update
sudo apt-get install yamllint
Вот текущие ошибки... но на самом деле их больше... начните с изменения всех отступов на 2 пробела, удалите лишние пробелы в скобках , измените комментарии на "* comment"...
35:12 error wrong indentation: expected 12 but found 11 (indentation)
36:24 error trailing spaces (trailing-spaces)
40:12 error wrong indentation: expected 12 but found 11 (indentation)
47:11 error wrong indentation: expected 12 but found 10 (indentation)
48:23 error too many spaces inside brackets (brackets)
35:26 error syntax error: expected <block end>, but found '<scalar>' (syntax)
48:33 error too many spaces inside brackets (brackets)
54:27 error too many spaces inside brackets (brackets)
54:44 error too many spaces inside brackets (brackets)
58:11 error wrong indentation: expected 12 but found 10 (indentation)
59:12 warning missing starting space in comment (comments)
61:12 warning missing starting space in comment (comments)
64:12 warning missing starting space in comment (comments)
64:11 warning comment not indented like content (comments-indentation)
65:16 warning missing starting space in comment (comments)
69:11 error wrong indentation: expected 12 but found 10 (indentation)
80:11 error wrong indentation: expected 12 but found 10 (indentation)
81:12 warning missing starting space in comment (comments)
83:12 warning missing starting space in comment (comments)
86:12 warning missing starting space in comment (comments)
87:17 warning missing starting space in comment (comments)
87:16 warning comment not indented like content (comments-indentation)
88:17 warning missing starting space in comment (comments)
Этот код .yaml передает lint...
network:
version: 2
renderer: networkd
ethernets:
eno1:
match:
macaddress: xx:xx:xx:xx:xx:xx
eno2:
match:
macaddress: xx:xx:xx:xx:xx:xx
eno3:
match:
macaddress: xx:xx:xx:xx:xx:xx
eno4:
match:
macaddress: xx:xx:xx:xx:xx:x
bonds:
bond0:
interfaces: [eno1, eno2]
parameters:
mode: balance-alb
mii-monitor-interval: 1
gratuitious-arp: 5
primary: eno1
vlans:
bond0.640:
id: 640
link: bond0
bond0.1008:
id: 1008
link: bond0
eno3.220:
id: 220
link: eno3
eno3.230:
id: 230
link: eno3
bridges:
br0:
interfaces: [bond0.1008]
addresses: [x.x.x.x/x]
gateway4: x.x.x.1
parameters:
forward-delay: 0
nameservers:
addresses: [x.x.x.x, y.y.y.y]
br1:
interfaces: [bond0.640]
parameters:
forward-delay: 0
br2:
interfaces: [eno3.220]
addresses: [x.x.x.x/x]
gateway4: x.x.x.1
parameters:
forward-delay: 0
nameservers:
addresses: [x.x.x.x, y.y.y.y]
br3:
interfaces: [eno3.230]
parameters:
forward-delay: 0
Примечание. См. https://netplan.io/examples/