From 58f7edae3530111dd2d67a20bc7240518da40e00 Mon Sep 17 00:00:00 2001
From: "alexandr.benzonan" <alexandra.benzonana@etu.hesge.ch>
Date: Sat, 8 Apr 2023 16:16:46 +0200
Subject: [PATCH] fix iface restart

---
 playbook.yaml | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/playbook.yaml b/playbook.yaml
index c4a2e69..290046c 100644
--- a/playbook.yaml
+++ b/playbook.yaml
@@ -1,21 +1,19 @@
 - name: Set eth0 static
   hosts: all
+  vars_files:
+    - vars.yml
   tasks:
     - name: Set iface static
       template:
         src: static_iface.j2
         dest: /etc/network/interfaces.d/ansible.conf
         mode: 0644
-- name: Restart networking eth0
-  hosts: all
-  tasks:
-    - name: Restart networking eth0
-      shell: ifdown eth0 && ifup eth0
-- name: Restart networking eth1
-  hosts: routers
-  tasks:
-    - name: Restart networking eth1
-      shell: ifdown eth1 && ifup eth1
+      notify: Restart networking
+  handlers:
+    - name: Restart networking
+      service:
+        name: networking
+        state: restarted
 - name: Test config by pinging
   hosts: H1
   tasks:
-- 
GitLab