|
|
@ -414,12 +414,31 @@ |
|
|
|
- network |
|
|
|
|
|
|
|
- name: Reset | Restart network |
|
|
|
service: |
|
|
|
name: "{{ reset_restart_network_service_name }}" |
|
|
|
state: restarted |
|
|
|
become: true |
|
|
|
vars: |
|
|
|
network_services: |
|
|
|
- NetworkManager |
|
|
|
- systemd-networkd |
|
|
|
- networking |
|
|
|
- network |
|
|
|
when: |
|
|
|
- ansible_os_family not in ["Flatcar", "Flatcar Container Linux by Kinvolk"] |
|
|
|
- reset_restart_network | bool |
|
|
|
tags: |
|
|
|
- services |
|
|
|
- network |
|
|
|
block: |
|
|
|
- name: Gather active network services |
|
|
|
# noqa command-instead-of-module |
|
|
|
command: systemctl is-active {{ item }} |
|
|
|
loop: "{{ network_services }}" |
|
|
|
register: service_status |
|
|
|
changed_when: false |
|
|
|
ignore_errors: true |
|
|
|
|
|
|
|
- name: Restart active network services |
|
|
|
systemd: |
|
|
|
name: "{{ item.item }}" |
|
|
|
state: restarted |
|
|
|
loop: "{{ service_status.results }}" |
|
|
|
when: item.stdout == "active" |