ansible/ansible — pull request #8041 by Tatsh (2014-07-06 01:08:32+00:00)
Title: Gentoo/OpenRC+systemd: check for systemd if falling back to service command

Currently there are some issues with systemd on Gentoo:
https://bugs.gentoo.org/show_bug.cgi?id=504116

For this reason, every profile even if systemd has openrc pulled in by default because otherwise some applications and scripts would break. Until the bug is resolved, all Gentoo machines using systemd will have OpenRC installed as well even if it is not necessarily being fully utilised.

This fix ensures that if `service` is found in `$PATH` (which points to `/sbin/rc`) and systemd is detected as PID 1, then `systemctl` gets used. Without this change, `service` will be used (and always say changed as true and somehow not fail).