>From page 28 in the book "Ansible for DevOps", the author says to try the 
following examples:


$ ansible multi -s -a "service ntpd stop"
$ ansible multi -s -a "ntpdate -q 0.rhel.pool.ntp.org"
$ ansible multi -s -a "service ntpd start"
Unfortunately, they each fail with the message:

myservername | FAILED | rc=127 >>
/bin/sh: service: command not found

Now, if I change the commands to include the full path, they work:

$ ansible multi -s -a "/sbin/service ntpd stop"
$ ansible multi -s -a "/usr/sbin/ntpdate -q 0.rhel.pool.ntp.org"
$ ansible multi -s -a "/sbin/service ntpd start"

Is the author's example broken? Or am I doing something wrong?

Naturally, I don't want to memorize (or type) the full path of each command 
that I'm issuing ad-hoc. I think that's the point of ad-hoc commands. It's 
supposed to be like sitting at the command line of the server(s) in question. 
Right?

How do I get the PATH included in my environment such that I can get these 
ad-hoc commands to work without including the full path in each command? Is 
there a way to set the path in an inventory file or the ansible.cfg file?

Any advice would be appreciated. Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/753778b9-9cc2-4593-a711-4f4d785c95e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to