OliP
OliP

Reputation: 81

How to force Ansible to use full path for executables Implicitly executed by modules like package or systemd

I'm working in an environment where the system's sudoers configuration mandates that commands like dnf, apt, and systemctl be executed with their full paths (e.g., /usr/bin/dnf, /usr/bin/systemctl). However, when I use Ansible's modules like package and systemd, these commands are invoked without the full path, which leads to permission issues due to the restrictions in the sudoers file.

I know I can work around this by using the shell or command modules with the full path, but that approach defeats the purpose of using Ansible's abstract modules, which are supposed to be independent of the underlying OS. I would prefer a solution that allows me to continue using these high-level modules without resorting to OS-specific command invocations.

Is there a way to configure Ansible to use the full path for these executables when they are implicitly called by modules like package or systemd, while still preserving the abstraction of the modules?

Upvotes: 0

Views: 38

Answers (0)

Related Questions