Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

8 роки тому
7 роки тому
6 роки тому
7 роки тому
6 роки тому
7 роки тому
6 роки тому
7 роки тому
6 роки тому
7 роки тому
6 роки тому
7 роки тому
6 роки тому
7 роки тому
6 роки тому
7 роки тому
6 роки тому
7 роки тому
7 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. {{ ansible_managed | comment }}
  2. {% set netif = item %}
  3. ### netif {{netif}}
  4. {% set dev = netifs[netif].device | default( 'enx' + netifs[netif].mac | regex_replace(':') ) %}
  5. auto {{dev}}
  6. {% if netifs[netif].type == "virt_ptp" %}
  7. # virt_pointopoint -> {{virt_host}} {{netifs[netif].virt_host_netif}}
  8. # ipv4
  9. {% set ips_ipv4 = netifs[netif] | json_query("ips[].ip") | ipv4("address") %}
  10. {% set ips_ipv4_first = ips_ipv4 | first %}
  11. {% set ips_ipv4 = ips_ipv4 | difference(ips_ipv4_first) %}
  12. {% set gateway4 = hostvars[virt_host].netifs[netifs[netif].virt_host_netif] | json_query("ips[].ip") | ipv4("address") | first %}
  13. iface {{ dev }} inet static
  14. address {{ ips_ipv4_first }}
  15. netmask 255.255.255.255
  16. pointopoint {{ gateway4 }}
  17. gateway {{ gateway4 }}
  18. {% for ip in ips_ipv4 %}
  19. iface {{ dev }} inet static
  20. address {{ ip }}
  21. netmask 32
  22. {% endfor %}
  23. # ipv6
  24. {% set ips_ipv6 = netifs[netif] | json_query("ips[].ip") | ipv6("address") %}
  25. {% set ips_ipv6_first = ips_ipv6 | first %}
  26. {% set ips_ipv6 = ips_ipv6 | difference(ips_ipv6_first) %}
  27. iface {{ dev }} inet6 static
  28. address {{ ips_ipv6_first }}
  29. netmask 128
  30. gateway {{ hostvars[virt_host].netifs[netifs[netif].virt_host_netif].ll6 }}
  31. {% for ip in ips_ipv6 %}
  32. iface {{ dev }} inet6 static
  33. address {{ ip }}
  34. netmask 128
  35. {% endfor %}
  36. {% else %}
  37. {% if netifs[netif].type == "bridge" %}
  38. # bridge
  39. iface {{ dev }} inet manual
  40. {% if netifs[netif].devices is defined %}
  41. bridge_ports {{ netifs[netif].devices | join(" ") }}
  42. {% else %}
  43. bridge_ports none
  44. {% endif %}
  45. {% endif %}
  46. {% for ip in netifs[netif].ips %}
  47. {% if ip.ip | ipv6 %}
  48. # ipv6 {{ip.ip}}
  49. iface {{ dev }} inet6 static
  50. address {{ ip.ip | ipv6('address') }}
  51. netmask {{ ip.ip | ipv6('prefix') }}
  52. {% endif %}
  53. {% if ip.ip | ipv4 %}
  54. # ipv4 {{ip.ip}}
  55. iface {{ dev }} inet static
  56. address {{ ip.ip | ipv4('address') }}
  57. network {{ ip.ip | ipv4('network') }}
  58. netmask {{ ip.ip | ipv4('prefix') }}
  59. broadcast {{ ip.ip | ipv4('broadcast') }}
  60. {% if loop.index == 1 and netifs[netif].routes is defined %}
  61. {% set default_route = netifs[netif].routes | json_query("[?to=='default']") | first %}
  62. gateway {{default_route.via}}
  63. {% endif %}
  64. {% endif %}
  65. {% endfor %}
  66. {% endif %}
  67. # dns resolvers
  68. iface {{ dev }} inet manual
  69. {% if netifs[netif].dns_resolvers is defined %}
  70. dns-nameservers {{ netifs[netif].dns_resolvers | join(" ") }}
  71. {% endif %}
  72. {% if netifs[netif].dns_search is defined%}
  73. dns-search {{ netifs[netif].dns_search | join(" ") }}
  74. {% endif %}