Browse Source

Add a way to configure reseted networking service name. (#10428)

pull/10455/head
Romain 1 year ago
committed by GitHub
parent
commit
a81c6d5448
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions
  1. 15
      roles/reset/defaults/main.yml
  2. 14
      roles/reset/tasks/main.yml

15
roles/reset/defaults/main.yml

@ -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
roles/reset/tasks/main.yml

@ -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"]

Loading…
Cancel
Save