I ran into a problem with the official Debian AMIs missing 'dbus' - trying to
set the hostname with 'hostnamectl', the command fails as below. A quick
apt-get update and install of dbus lets hostnamectl behave as expected.
root@ip-10-200-10-94:~# hostnamectl
Failed to create bus connection: No such file or directory
I ran into this error as it blocked my Ansible setup (v2.2), as the standard
hostname module sets names via hostnamectl.
And I'd say this is the clue of the issue, Ansible is not checking what is
actually available but assuming that it has whole Systemd ecosystem to it's
disposal.
I just have to point out that I used Ansible for few times even in big
installations including writing some modules and extensions but my knowledge
can be out dated a bit.
Anyway from what I know Ansible can run on BSDs as well so this will fail there
entirely as hostnamectl is not available, thus I'd log this as a bug against
Ansible cause it assumes Systemd + surroundings without checking (and if it
checks then doing it badly).