Skip to content

Commit

Permalink
Add a way to configure reseted networking service name. (kubernetes-s…
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMou authored and pedromcpedro committed May 8, 2024
1 parent 8826c22 commit 7e485ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
15 changes: 15 additions & 0 deletions roles/reset/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
---
flush_iptables: true
reset_restart_network: true

reset_restart_network_service_name: >-
{% if ansible_os_family == "RedHat" -%}
{%-
if ansible_distribution_major_version | int >= 8
or is_fedora_coreos or ansible_distribution == "Fedora" -%}
NetworkManager
{%- else -%}
network
{%- endif -%}
{%- elif ansible_distribution == "Ubuntu" -%}
systemd-networkd
{%- elif ansible_os_family == "Debian" -%}
networking
{%- endif %}
14 changes: 1 addition & 13 deletions roles/reset/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -429,19 +429,7 @@

- name: Reset | Restart network
service:
# noqa: jinja[spacing]
name: >-
{% if ansible_os_family == "RedHat" -%}
{%- if ansible_distribution_major_version | int >= 8 or is_fedora_coreos or ansible_distribution == "Fedora" -%}
NetworkManager
{%- else -%}
network
{%- endif -%}
{%- elif ansible_distribution == "Ubuntu" -%}
systemd-networkd
{%- elif ansible_os_family == "Debian" -%}
networking
{%- endif %}
name: "{{ reset_restart_network_service_name }}"
state: restarted
when:
- ansible_os_family not in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
Expand Down

0 comments on commit 7e485ed

Please sign in to comment.