# Issue with service facts module on AWX 21.6.0

**URL:** <https://forum.ansible.com/t/issue-with-service-facts-module-on-awx-21-6-0/37902>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 19, 2023, 2:08pm UTC](https://forum.ansible.com/t/issue-with-service-facts-module-on-awx-21-6-0/37902 "2023-04-19T14:08:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Dolan](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@David\_Dolan](https://forum.ansible.com/u/David_Dolan)\
**Post date:** [April 19, 2023, 2:08pm UTC](https://forum.ansible.com/t/issue-with-service-facts-module-on-awx-21-6-0/37902/1 "2023-04-19T14:08:52Z")

</div>

Hi,

I have an Ansible job with the following task

- name: Stop the running NTPd service  
service:  
name: ntpd  
state: stopped  
enabled: no  
when:
- ansible\_facts.services[“ntpd.service”] is defined or ansible\_facts.services[“ntpd”] is defined

If ntpd is not installed on AWX 21.6.0 this task tries to stop NTPD so fails. I only want it to run if ntpd is installed  
It works ok on an older AWX version.

I ran the job in Verbose mode. The status shows as not-found since it’s not installed.  
On a previous version it may not be listed with any status so that’s possibly the reason.

“ntpd.service”: {

“status”: “not-found”,  
“source”: “systemd”,  
“state”: “stopped”,  
“name”: “ntpd.service”

I then tried to get around it by adding the following line also but it didn’t help

- (ansible\_facts.services[“ntpd.service”][‘status’] != ‘not-found’) or (ansible\_facts.services[“ntpd”][‘status’] != ‘not-found’)

I may be going around it the wrong way.  
Anybody have any ideas how I can get the job when run from AWX 21.6.0 to only try to stop ntpd if it’s not installed?

Thanks  
David

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [April 19, 2023, 2:37pm UTC](https://forum.ansible.com/t/issue-with-service-facts-module-on-awx-21-6-0/37902/2 "2023-04-19T14:37:19Z")

</div>

You can use ignore\_errors: true so it doesn’t cause the playbook to fail if the service is not present.

> - name: Stop the running NTPd service  
> service:  
> name: ntpd  
> state: stopped  
> enabled: no

> ignore\_errors: true

Walter

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [April 19, 2023, 2:40pm UTC](https://forum.ansible.com/t/issue-with-service-facts-module-on-awx-21-6-0/37902/3 "2023-04-19T14:40:58Z")

</div>

Well that formatting was butchered wasn’t it.

- name: Stop the running NTPd service  
service:  
name: ntpd  
state: stopped  
enabled: no  
ignore\_errors: true

Walter

---

<div class="post-metadata">

**Author:** ![Premchand\_Gupta](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@Premchand\_Gupta](https://forum.ansible.com/u/Premchand_Gupta)\
**Post date:** [April 19, 2023, 4:02pm UTC](https://forum.ansible.com/t/issue-with-service-facts-module-on-awx-21-6-0/37902/4 "2023-04-19T16:02:03Z")

</div>

some servers used chronyd service as NTP. it was an option for RHEL 7 and 8

also, the play is not able to recognize the status of the service. if you can login on to servers and check manually what is the status of the same.

---

<div class="post-metadata">

**Author:** ![David\_Dolan](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@David\_Dolan](https://forum.ansible.com/u/David_Dolan)\
**Post date:** [April 19, 2023, 5:54pm UTC](https://forum.ansible.com/t/issue-with-service-facts-module-on-awx-21-6-0/37902/5 "2023-04-19T17:54:59Z")

</div>

We use chrony so I’m just ensuring ntp is not installed.  
This server doesn’t have ntp installed. On previous versions the job handled that and my task worked.

But now it seems the job finds it as “not-found” and tries to stop ntp even if it is not installed so would like to work around that. Walter mentioned setting ignore\_errors to true. Was thinking there may be another way around it
