Article 51PJ4 Need bash script to compare the salt diff between multiple servers

Need bash script to compare the salt diff between multiple servers

by
kkraju90
from LinuxQuestions.org on (#51PJ4)
login_server1:
----------
ID: sudoers
Function: file.managed
Name: /etc/sudoers
Result: None
Comment: The file /etc/sudoers is set to be changed
Started: 16:20:19.495358
Duration: 34.495 ms
Changes:
----------
mode:
0400
----------
ID: autofs_direct
Function: file.managed
Name: /etc/auto.direct
Result: None
Comment: The file /etc/auto.direct is set to be changed
Started: 16:20:19.686555
Duration: 19.359 ms
Changes:
----------
diff:
---
+++
@@ -4,7 +4,7 @@

/five -fstype=nfs4,nfsvers=4.1,rw,hard,intr,acl,noatime,nodev,nosuid netapp1-nfs1.internal.com:/five
-/singularity -fstype=nfs4,nfsvers=4.1,rw,hard,intr,acl,noatime,nodev netapp1-nfs1.internal.com:/singularity
+/singularity -fstype=nfs4,nfsvers=4.1,rw,hard,intr,acl,noatime,nodev netapp1-nfs1.internal.com:/singularity
/work -fstype=nfs4,nfsvers=4.1,rw,hard,intr,acl,noatime,nodev,nosuid netapp1-nfs2.internal.com:/work

login_server2:
----------
ID: sudoers
Function: file.managed
Name: /etc/sudoers
Result: None
Comment: The file /etc/sudoers is set to be changed
Started: 16:21:47.725510
Duration: 33.609 ms
Changes:
----------
mode:
0400
ID: input_disk_tmp_agent
Function: file.managed
Name: /etc/telegraf/telegraf.d/input-disk-tmp.conf
Result: None
Comment: The file /etc/telegraf/telegraf.d/input-disk-tmp.conf is set to be changed
Started: 16:21:39.109122
Duration: 117.054 ms
Changes:
----------
diff:
---
+++
@@ -1,3 +1,3 @@
[[inputs.disk]]
interval = "60s"
- mount_points = ['/tmp']
+ mount_points = ["/tmp"]
The a above are salt diff between two servers by command,

sudo salt 'login_server*' state.apply --output-diff test=true
The output is expected to be,

login_server1:
----------
ID: autofs_direct
Changes:
----------
diff:
---
+++
@@ -4,7 +4,7 @@

/five -fstype=nfs4,nfsvers=4.1,rw,hard,intr,acl,noatime,nodev,nosuid netapp1-nfs1.internal.com:/five
-/singularity -fstype=nfs4,nfsvers=4.1,rw,hard,intr,acl,noatime,nodev netapp1-nfs1.internal.com:/singularity
+/singularity -fstype=nfs4,nfsvers=4.1,rw,hard,intr,acl,noatime,nodev netapp1-nfs1.internal.com:/singularity
/work -fstype=nfs4,nfsvers=4.1,rw,hard,intr,acl,noatime,nodev,nosuid netapp1-nfs2.internal.com:/work

login_server2:
----------
ID: input_disk_tmp_agent
Changes:
----------
diff:
---
+++
@@ -1,3 +1,3 @@
[[inputs.disk]]
interval = "60s"
- mount_points = ['/tmp']
+ mount_points = ["/tmp"]

I have multiple servers running salt states running on them. Whenever I run salt diff output command above, I see differences between them. So In a timely manner I need to run a script and get the difference between the salt diff among all the servers . Above is a sample expected output.

Could you please help me getting a bash script to compare the salt diff outputs between multiple servers.latest?d=yIl2AUoC8zA latest?i=tIsW2YnEq6M:tYWBL7Wl4Vo:F7zBnMy latest?i=tIsW2YnEq6M:tYWBL7Wl4Vo:V_sGLiP latest?d=qj6IDK7rITs latest?i=tIsW2YnEq6M:tYWBL7Wl4Vo:gIN9vFwtIsW2YnEq6M
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments