From 4c4e7e455d6645555ecc272e8e21e2c58852572e Mon Sep 17 00:00:00 2001
From: handreas <andreas.hamacher@monash.edu>
Date: Mon, 10 May 2021 03:33:15 +0000
Subject: [PATCH] removing one changed on service IPtables restarted

---
 roles/nat_server/tasks/main.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/roles/nat_server/tasks/main.yml b/roles/nat_server/tasks/main.yml
index 9a968c54..40d466f1 100644
--- a/roles/nat_server/tasks/main.yml
+++ b/roles/nat_server/tasks/main.yml
@@ -57,7 +57,7 @@
   when: sys_conf.changed
 
 - name: Install keepalived
-  yum: 
+  package:
     name: keepalived
     state: present
   become: true
@@ -72,6 +72,7 @@
   template: dest=/etc/systemd/system/keepalived.service src=keepalived.service.j2
   become: true
   become_user: root
+  register: keepalivedconfig
 
 - name: Enable and start keepalived
   service:
@@ -80,6 +81,7 @@
     enabled: yes
   become: true
   become_user: root
+  when: keepalivedconfig.changed
 
 - name: Restart iptables service
   service:
@@ -87,4 +89,4 @@
     state: restarted
   become: true
   become_user: root
-
+  when: keepalivedconfig.changed
-- 
GitLab