Skip to content

Commit

Permalink
fix(networkd): use networkctl to reload config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
toanju committed Apr 25, 2021
1 parent 6fb14d5 commit f4be1ed
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions systemd/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ systemd:
PollIntervalMaxSec: 2048

networkd:
# networkctl reload is available since systemd 244
networkctl_reload: false
pkg: {}
path: /etc/systemd/network
service: systemd-networkd
Expand Down
14 changes: 9 additions & 5 deletions systemd/networkd/profiles.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
{%- set networkd = systemd.get('networkd', {}) %}
{%- set profiles = networkd.get('profiles', {}) %}
{%- if networkd.networkctl_reload %}
include:
- systemd.reload
- systemd.networkd.reload
{%- endif %}
{% if profiles is mapping %}
{% for networkdprofile, types in profiles.items() %}
Expand All @@ -23,8 +25,10 @@ include:
- dir_mode: 755
- context:
config: {{ profileconfig|json }}
{%- if networkd.networkctl_reload %}
- watch_in:
- cmd: reload_systemd_configuration
{% endfor %}
{% endfor %}
{% endif %}
- cmd: systemd-networkd-reload-cmd-wait
{%- endif %}
{%- endfor %}
{%- endfor %}
{%- endif %}
9 changes: 9 additions & 0 deletions systemd/networkd/reload.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include:
- systemd.networkd

systemd-networkd-reload-cmd-wait:
cmd.wait:
- name: networkctl reload
- runas: root
- require:
- service: networkd
1 change: 1 addition & 0 deletions systemd/osmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Fedora:
pkgs_extra:
- python3-systemd
networkd:
networkctl_reload: true
pkg: {}
resolved:
pkg: {}

0 comments on commit f4be1ed

Please sign in to comment.