netbird_client: write the MTU even when an earlier task already stopped netbird
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
when: netbird_config_mtu_file.content is defined
|
when: netbird_config_mtu_file.content is defined
|
||||||
vars:
|
vars:
|
||||||
netbird_config_mtu: "{{ netbird_config_mtu_file.content | b64decode | from_json }}"
|
netbird_config_mtu: "{{ netbird_config_mtu_file.content | b64decode | from_json }}"
|
||||||
|
netbird_mtu_differs: "{{ (netbird_config_mtu.MTU | default(0)) != (netbird_client.mtu | int) }}"
|
||||||
tags: netbird_client_config
|
tags: netbird_client_config
|
||||||
block:
|
block:
|
||||||
# netbird writes its in-memory config back on exit, so edit only while it is stopped
|
# netbird writes its in-memory config back on exit, so edit only while it is stopped
|
||||||
@@ -54,15 +55,14 @@
|
|||||||
systemd:
|
systemd:
|
||||||
name: netbird
|
name: netbird
|
||||||
state: stopped
|
state: stopped
|
||||||
when: (netbird_config_mtu.MTU | default(0)) != (netbird_client.mtu | int)
|
when: netbird_mtu_differs
|
||||||
notify: restart_netbird
|
notify: restart_netbird
|
||||||
register: netbird_mtu_stopped
|
|
||||||
|
|
||||||
- name: Re-read netbird config after stop
|
- name: Re-read netbird config after stop
|
||||||
slurp:
|
slurp:
|
||||||
src: /var/lib/netbird/default.json
|
src: /var/lib/netbird/default.json
|
||||||
register: netbird_config_mtu_stopped
|
register: netbird_config_mtu_stopped
|
||||||
when: netbird_mtu_stopped is changed
|
when: netbird_mtu_differs
|
||||||
|
|
||||||
- name: Write MTU
|
- name: Write MTU
|
||||||
copy:
|
copy:
|
||||||
@@ -71,7 +71,8 @@
|
|||||||
mode: "0600"
|
mode: "0600"
|
||||||
vars:
|
vars:
|
||||||
cfg: "{{ netbird_config_mtu_stopped.content | b64decode | from_json }}"
|
cfg: "{{ netbird_config_mtu_stopped.content | b64decode | from_json }}"
|
||||||
when: netbird_mtu_stopped is changed
|
when: netbird_mtu_differs
|
||||||
|
notify: restart_netbird
|
||||||
|
|
||||||
- name: Set netbird log level
|
- name: Set netbird log level
|
||||||
copy:
|
copy:
|
||||||
|
|||||||
Reference in New Issue
Block a user