From afc442ffa3e818bc850ac072d4da0bc2393c03dc Mon Sep 17 00:00:00 2001
From: handreas <andreas.hamacher@monash.edu>
Date: Mon, 4 May 2020 23:06:23 +0000
Subject: [PATCH] ubuntu and centos have different pathing

Former-commit-id: 876e6e09487a031e73c3e57cc4217ece3c52b7a1
---
 roles/etcHosts/tasks/main.yml | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/roles/etcHosts/tasks/main.yml b/roles/etcHosts/tasks/main.yml
index f46c3dbd..fc85df29 100644
--- a/roles/etcHosts/tasks/main.yml
+++ b/roles/etcHosts/tasks/main.yml
@@ -3,27 +3,18 @@
   become: true
 
 - name: get hostname by sysctl
-  shell: /usr/sbin/sysctl kernel.hostname | /bin/cut -f 3 -d " "
+  shell: /sbin/sysctl kernel.hostname | /usr/bin/cut -f 3 -d " "
   register: sysctl_hostname
   check_mode: no
   changed_when: False
 
-- debug:
-    var: sysctl_hostname
-  when: not sysctl_hostname.stdout == inventory_hostname
-
-- debug:
-    var: inventory_hostname
-  when: not sysctl_hostname.stdout == inventory_hostname
-  
-
 - name: set hostname by sysctl
-  shell: /usr/sbin/sysctl kernel.hostname="{{ inventory_hostname }}"
+  shell: /sbin/sysctl kernel.hostname="{{ inventory_hostname }}"
   become: true
   when: not sysctl_hostname.stdout == inventory_hostname
 
 - name: get domainname by sysctl
-  shell: /usr/sbin/sysctl kernel.domainname | cut -f 3 -d " "
+  shell: /sbin/sysctl kernel.domainname | cut -f 3 -d " "
   register: sysctl_domainname
   check_mode: no
   changed_when: False
@@ -31,7 +22,7 @@
   become_user: root
 
 - name: set domainname by sysctl
-  shell: /usr/sbin/sysctl kernel.domainname="{{ domain }}"
+  shell: /sbin/sysctl kernel.domainname="{{ domain }}"
   become: true
   when: not sysctl_domainname.stdout  ==  domain 
 
-- 
GitLab