Ansible is one of the most popular automation engines in the world. It lets you automate virtually anything, from setup of a local system to huge groups of platforms and apps. It’s cross platform, so you can use it with all sorts of operating systems. Read on for more information on how to get the latest Ansible in Fedora, some of its changes and improvements, and how to put it to use.
Releases and features
Ansible 2.8 was recently released with many fixes, features, and enhancements. It was available in Fedora mere days afterward as an official update in Fedora 29 and 30, as well as EPEL. The follow-on version 2.8.1 released two weeks ago. Again, the new release was available within a few days in Fedora.
Installation is, of course, easy to do from the official Fedora repositories using sudo:
$ sudo dnf -y install ansible
The 2.8 release has a long list of changes, and you can read them in the Porting Guide for 2.8. But they include some goodies, such as Python interpreter discovery. Ansible 2.8 now tries to figure out which Python is preferred by the platform it runs on. In cases where that fails, Ansible uses a fallback list. However, you can still use a variable ansible_python_interpreter to set the Python interpreter.
Another change makes Ansible more consistent across platforms. Since sudo is more exclusive to UNIX/Linux, and other platforms don’t have it, become is now used in more places. This includes command line switches. For example, –ask-sudo-pass has become –ask-become-pass, and the prompt is now BECOME password: instead.
There are many more features in the 2.8 and 2.8.1 releases. Do check out the official changelog on GitHub for all the details.
Maybe you’re not sure if Ansible is something you could really use. Don’t worry, you might not be alone in thinking that, because it’s so powerful. But it turns out that it’s not hard to use it even for simple or individual setups like a home with a couple computers (or even just one!).
We covered this topic earlier in the Fedora magazine as well:
Give Ansible a try and see what you think. The great part about it is that Fedora stays quite up to date with the latest releases. Happy automating!
Neville A. Cross
I tried Ansible and was interesting to have a easy way to get your computer as you wanted after fresh install. From update, to set some user settings, installing rpmfusion and packages.
To me, the odd thing is the documentation. There is no big picture of how you make a playbook. There is plenty of examples of each action, but I have to stumble my way to a functioning structure. I only know it works, but not sure is efficient.
Nevertheless, I enjoyed until Fedora 30. It deprecated a python 2 package. Supposedly, the new version of Ansible will auto-discover the proper python interpreter. It is not working for me. Maybe because my twisted setup. In any case, it is possible to force the python3 interpreter. It is very clearly explained how, but not where. I stumbled again my way to making it work.
So, besides some hiccups, it is really amazing what it can do for an individual computer. I bet it works wonders for people having to deal with many computers and servers.
Paul W. Frields
@Neville: I found that the easiest way to learn Ansible playbooking was by looking at other people’s playbooks. GitHub, for instance, has many examples of personal playbooks. If you’re looking for something much more complex, the Fedora infrastructure team maintains a public repository with lots of interesting usage. As for variables like the one that sets Python interpreter, they work in many places depending on the scope where you want them to apply, so there’s not one answer as to where to use them.
You could check this thread on the topic https://discussion.fedoraproject.org/t/how-i-automated-my-fedora-workstation-with-modular-ansible-roles/579, it seems pertinent to your question.