The role checks if the system is running or not systemd. It checks the
name of the process with PID1, and if it contains the string "systemd"
assumes that the host is systemd-based. Unfortunately that check fails
in Ubuntu Xenial:
vagrant@mongo-xenial:~$ cat /proc/1/cmdline
/sbin/init
A better approach may be to check if /sbin/init is a symlink or a
binary. In systemd-based systems (e.g. Ubuntu Xenial), /sbin/init is a
symlink to the systemd binary:
vagrant@mongo-xenial:~$ file /sbin/init
/sbin/init: symbolic link to /lib/systemd/systemd
In Ubuntu Trusty /sbin/init is a binary:
vagrant@mongo-trusty:~$ file /sbin/init
/sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=7a4c688d009fc1f06ffc692f5f42ab09e68582b2, strippe
This commit attempts to solve the problem described above. The systemd
check has been rewritten to check if /sbin/init is a binary or a
symlink.
Looks like when this variable was introduced, this particular task was
missed.
This has also been moved to the configuration stage, since it seems to
fit with the task for ensuring the log directory exists, too.
It appears that standard mongo install process on debian doesn't create the /data/db directory. This prevents mongo process from starting and required manual job on the server.
With this fix the /data/db directory will be created by ansible during install process.