Explorar el Código

set interface names with systemd network links

netifs
padre
commit
e005b0a31d
Se han modificado 2 ficheros con 20 adiciones y 0 borrados
  1. +13
    -0
      tasks/main.yml
  2. +7
    -0
      templates/systemd-network.link.j2

+ 13
- 0
tasks/main.yml Ver fichero

@@ -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 Ver fichero

@@ -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}}

Cargando…
Cancelar
Guardar