# NTP Query vs. NTPstat using Ansible

**URL:** <https://forum.ansible.com/t/ntp-query-vs-ntpstat-using-ansible/26707>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [February 12, 2018, 3:04pm UTC](https://forum.ansible.com/t/ntp-query-vs-ntpstat-using-ansible/26707 "2018-02-12T15:04:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alan\_Harkleroad](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Alan\_Harkleroad](https://forum.ansible.com/u/Alan_Harkleroad)\
**Post date:** [February 12, 2018, 3:04pm UTC](https://forum.ansible.com/t/ntp-query-vs-ntpstat-using-ansible/26707/1 "2018-02-12T15:04:32Z")

</div>

I setup a simple alias for my boss since he likes to run NTP queries for our rack system. One of my server wont return a ntpq -pn remotely but will execute it locally. Not sure why. Comes back with command not found rc=127, similar servers with the same OS Baseline have no issue. Just curious why this might be happening.

ansible -m shell -a “ntpq -pn” ‘servers-linux’

In my [servers-linux] inventory group is a mixed topology of 32 and 64 bit systems, all running CentOS or RHEL, 6.9 or 7.4.

Now if I run ansible -m -a “ntpstat” ‘servers-linux’ that same host returns a response instead of error code.

Any help is appreciated as to why this might be happening.

---

<div class="post-metadata">

**Author:** ![Alan\_Harkleroad](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Alan\_Harkleroad](https://forum.ansible.com/u/Alan_Harkleroad)\
**Post date:** [February 12, 2018, 3:22pm UTC](https://forum.ansible.com/t/ntp-query-vs-ntpstat-using-ansible/26707/2 "2018-02-12T15:22:16Z")

</div>

Now I did find by adding the path to ntpq it resolved the issue, just not sure why I needed to on that one host when 2 identical hosts dont require the path to be sourced.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [February 12, 2018, 3:30pm UTC](https://forum.ansible.com/t/ntp-query-vs-ntpstat-using-ansible/26707/3 "2018-02-12T15:30:22Z")

</div>

The environment isn't the same on the hosts so PATH differ and it can't find ntpq.
