Possible to show diff between local and remote directories?

Hi all,

I’m attempting to implement deploying Splunk app updates through Ansible. I’ve been using the ansible-role-for-splunk project as a starting point, however that project uses synchronize as the way it copies the app directories locally to the remote server. That module uses passwordless sudo and we are not allowed to use that. I’ve been trying to use the copy module instead and I’m stuck at the moment.

I was hoping that during --check, the copy module would output the diff between all the files that will be updated, but it appears that it will not do that with a recursive directory copy.

Is there a way that I can have Ansible show the diffs of each file that’s different, and files that that exist on one server and not the other, in --check?

We faced a similar problem when we were deploying tomcat apps: two instances on each of half a dozen servers. The deployment directories were supposed to all have the same contents, but sometimes one didn’t. (Very rarely.) We eventually realized that we didn’t actually care what was different; it was enough to know that they weren’t identical. So we used find to get a list of all the files, sorted that, ran md5sum on all of those (timestamps weren’t relevant, just contents), which gave us a long list of md5sums sorted by filenames. Then we’d run md5sum on that list, which we registered. Comparing each host’s registered md5sum with the most common md5sum from all the hosts flagged differences. Usually they were all identical, but on those rare occasions (never explained, btw) when one was broken, we could re-deploy the app to that host’s instance and all would be good. I’ve got the Ansible code around somewhere if you’d like to have it.

In a completely other direction: we’ve been tweaking a “deploy/update Splunk apps” role for the past year. If you’d like to see the approach we took I can share that with you. Direct message me if you’d like.

If you aren’t using passwordless sudo, what are you using? I assume sudo as the splunk user with password, but maybe something else?