Procházet zdrojové kódy

set interface names with systemd network links

netifs
rodič
revize
e005b0a31d
2 změnil soubory, kde provedl 20 přidání a 0 odebrání
  1. +13
    -0
      tasks/main.yml
  2. +7
    -0
      templates/systemd-network.link.j2

+ 13
- 0
tasks/main.yml Zobrazit soubor

@@ -40,3 +40,16 @@
with_items: "{{ _netifs }}"
when:
- ( root_target_dist | default('debian') ) == "debian"

- name: systemd network dir
file:
path: "{{ root_target_directory | default('') }}/etc/systemd/network"
state: directory

- name: systemd network interface names
template:
src: systemd-network.link.j2
dest: "{{ root_target_directory | default('') }}/etc/systemd/network/10-{{ item }}.link"
with_items: "{{ _netifs }}"
when:
- ( root_target_dist | default('debian') ) == "debian"

+ 7
- 0
templates/systemd-network.link.j2 Zobrazit soubor

@@ -0,0 +1,7 @@
{{ ansible_managed | comment }}
{% set netif = item %}
{% set dev = netifs[netif].device | default( 'enx' + netifs[netif].mac | regex_replace(':') ) %}
[Match]
MACAddress={{netifs[netif].mac}}
[Link]
Name={{dev}}

Načítá se…
Zrušit
Uložit