Allow networkd filename override
- Allow configuring the default filename format - Allow configuring a filename override on a per netdev/network basis. Change-Id: I801fe5604d543ae36daf5bd1764ef1035644ea44
This commit is contained in:
parent
48e9cfbcdf
commit
b9b135ab9a
@ -19,6 +19,10 @@ systemd_interface_cleanup: false
|
||||
# Enable systemd-networkd and (re)start the service
|
||||
systemd_run_networkd: false
|
||||
|
||||
# Default filename formatting
|
||||
systemd_networkd_netdev_filename: "{{ item.0 }}-{{ item.1.NetDev.Name }}.netdev"
|
||||
systemd_networkd_network_filename: "{{ item.0 }}-{{ item.1.interface }}.network"
|
||||
|
||||
# The `systemd_link_config_overrides` option can be used on the default link.
|
||||
# See the following link for all available options:
|
||||
# https://www.freedesktop.org/software/systemd/man/systemd.link.html
|
||||
@ -41,6 +45,7 @@ systemd_link_config_overrides: {}
|
||||
# - NetDev:
|
||||
# Name: dummy1
|
||||
# Kind: dummy
|
||||
# filename: "{{ item.1.NetDev.Name }}.netdev"
|
||||
# - NetDev:
|
||||
# Name: bond0
|
||||
# Kind: bond
|
||||
@ -84,6 +89,7 @@ systemd_netdevs: []
|
||||
# bridge: "bond0"
|
||||
# mtu: 9000
|
||||
# - interface: "dummy1"
|
||||
# filename: "{{ item.1.interface }}.network"
|
||||
# bridge: "bond0"
|
||||
# mtu: 9000
|
||||
# - interface: "bond0"
|
||||
|
@ -55,7 +55,7 @@
|
||||
- name: Create systemd-networkd network device(s)
|
||||
template:
|
||||
src: "systemd-netdev.j2"
|
||||
dest: "/etc/systemd/network/{{ item.0 }}-{{ item.1.NetDev.Name }}.netdev"
|
||||
dest: "/etc/systemd/network/{{ item.1.filename | default(systemd_networkd_netdev_filename) }}"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
@ -66,7 +66,7 @@
|
||||
- name: Create systemd-networkd network(s)
|
||||
config_template:
|
||||
src: "systemd-network.j2"
|
||||
dest: "/etc/systemd/network/{{ item.0 }}-{{ item.1.interface }}.network"
|
||||
dest: "/etc/systemd/network/{{ item.1.filename | default(systemd_networkd_network_filename) }}"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
|
@ -1,9 +1,12 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% set _ignored_sections = ['filename'] %}
|
||||
{% for key, values in item.1.items() %}
|
||||
{% if key not in _ignored_sections %}
|
||||
[{{ key }}]
|
||||
{% for k, v in values.items() %}
|
||||
{{ k }}={{ v }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user