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

pull/10455/head
Romain 2023-09-20 11:28:01 +02:00 committed by GitHub
parent 6b34e3ef08
commit a81c6d5448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View File

@ -1,3 +1,18 @@
--- ---
flush_iptables: true flush_iptables: true
reset_restart_network: 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 %}

View File

@ -429,19 +429,7 @@
- name: Reset | Restart network - name: Reset | Restart network
service: service:
# noqa: jinja[spacing] name: "{{ reset_restart_network_service_name }}"
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 %}
state: restarted state: restarted
when: when:
- ansible_os_family not in ["Flatcar", "Flatcar Container Linux by Kinvolk"] - ansible_os_family not in ["Flatcar", "Flatcar Container Linux by Kinvolk"]