That’s a very nice question. I like that question because I think that more or less – or the answer could more or less sum up a lot of what we’ve been talking about now. I very much like that question.
There are differences, of course, and these differences are mainly due to the – underlying target operating system so let us suppose we have an ansible controller which is the the system on which ansible is installed and i’m going to now target on one hand let’s say a freebsd system and on the other hand let’s say a santos or debian system there are initially some differences of course One of the differences, for example, is that if we want to have privilege escalation on the target systems, we would need to install sudo, for example, or do as on FreeBSD because FreeBSD does not come with these utilities. So that is something we would need to install if we wanted to use that or if we required to use that. On the other hand…
For example, FreeBSD would require an installation of Python because FreeBSD does not by default, I think, come with a version of Python. Let’s assume we’ve done that. Let’s assume, for example, during installation, we’ve ensured that we have those prerequisites. then on the Ansible controller, we have relatively little that we need to take care of.
But yes, of course, there are differences. If you write what is called a playbook to deploy software or to deploy configuration onto these systems, you will have to account for certain differences. So for example, on your Linux machine, you will, as we just spoke earlier, you will create a file called slash etc slash httpd slash whatever.
And on the FreeBSD side, that might be called slash user slash local slash etc slash httpd slash whatever. So we have to account for these differences. That is the reason why Ansible For example, it has its fact variables, which tell us which flavor operating system are we on, specific paths, IP addresses, all sorts of technical information about the systems that we are deploying onto.
So if you spend a little bit of time, not too much, if you spend a little bit of time thinking about this and preparing, then the end result is basically that you, yes, you can deploy onto either flavor. Now, there are inherent differences. So, for example, this happened, I think it was mid last year.
I had a playbook which needed to run make, the make utility on the target system. And it worked flawlessly on Linux. and it failed on FreeBSD. Now, the reason it failed on FreeBSD is FreeBSD by default does not come with GNU Make, whereas Linux comes with GNU Make.
These are two completely different tools. So you have the BSD Make on the one hand, and you have the GNU Make on the other hand. GNU Make has a very large number of additional capabilities and options.
The reason the Ansible module failed is the module… the Ansible component, the Ansible module, was invoking make with dash dash file make file name. But the BSD make does not recognize this option dash dash file. The BSD make only knows an option dash F.
I was able to fix this, of course, very quickly locally, and I then provided one of my trivial patches, which was then applied. to change the module in the Ansible distribution to only use “-f”, which would then do exactly the same thing on both sides. So there are differences. Some of these differences we can very easily work around.
Others require maybe additional installation. So you have, for example, the unarchive module in Ansible land, which is able to extract a zip or a tar or compressed tar file. Now, this unarchive module, the unarchive Ansible module, has been written, apparently, by somebody who was only familiar with tar on Linux.
And tar on Linux, that is GNU tar. which has a boatload of additional options compared to the original TARs or to the FreeBSD TAR. So the unarchived module, in order to execute that on a BSD machine, requires the gtar package. Now, this is documented.
It’s documented in the module. So in other words, your playbook would need to account here again for the FreeBSD machine and would need to additionally install the gtar package. So these are the kind of things that we… that we have to realize, that we have to know.
Here again, to my mind, it’s important that this is possible. It is important that we can use Ansible to distribute to basically any Unix-like operating system. And yes, we can even do Windows now.
And these operating systems are different. And I think what is most important for me is that people who write Ansible modules should maybe be more aware, if they aren’t already, but made aware of the fact that there are differences in the Unixes and the target Unixes, and try and accommodate for these differences, if at all possible. So, back to your question.
Is it possible or is it very difficult to run Ansible against different Unix versions, against different Linux versions? The answer typically is no, it is not difficult. There’s a few things that you need to look out for, a few things that need configuring, for example, the path to the Python interpreter.
But other than that, we can run playbooks, and I do this a lot. I teach this also in trainings since about two and a half years. I’ve been doing trainings again.
I’ve been teaching. I’m hugely… I’m hugely liking this again.
And so these are things that I very explicitly point out in my trainings, that one has to attempt to be portable.