Просмотр исходного кода

set interface names with systemd network links

netifs
Markus Katharina Brechtel 6 лет назад
Родитель
Сommit
e005b0a31d
2 измененных файлов: 20 добавлений и 0 удалений
  1. +13
    -0
      tasks/main.yml
  2. +7
    -0
      templates/systemd-network.link.j2

+ 13
- 0
tasks/main.yml Просмотреть файл

@@ -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 Просмотреть файл

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

Загрузка…
Отмена
Сохранить