Failed to install package NTP

284 views
Skip to first unread message

arjungoel 1995

unread,
Jul 22, 2023, 3:27:11 PM7/22/23
to Ansible Project
Hi, I was just testing a basic playbook in Ansible. Here is the playbook code:

---
- name: Set up NTP on all servers
  hosts: all
  become: true
  tasks:
    - name: Ensure NTP is installed
      yum:
        name: ntp
        state: present
    - name: Ensure NTP is running
      service:
        name: ntpd
        state: started
        enabled: yes


When I am running the ansible-playbook playbook.yaml command, I am getting this error:

TASK [Ensure NTP is installed] ****************************************************************************************************************
fatal: [3.226.126.95]: FAILED! => {"changed": false, "failures": ["No package ntp available."], "msg": "Failed to install some of the specified packages", "rc": 1, "results": []}

PLAY RECAP ************************************************************************************************************************************
3.226.126.95               : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  


Please help me.

Mike Eggleston

unread,
Jul 22, 2023, 3:43:19 PM7/22/23
to ansible...@googlegroups.com
ntpd?

Mike

On Jul 22, 2023, at 14:27, arjungoel 1995 <arjung...@gmail.com> wrote:

Hi, I was just testing a basic playbook in Ansible. Here is the playbook code:
--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/07819a01-fc33-48d4-b2fe-3645699e1701n%40googlegroups.com.

Todd Lewis

unread,
Jul 22, 2023, 3:45:48 PM7/22/23
to Ansible Project
Maybe chrony rather than ntp? What OS is your target host running?

Rilindo Foster

unread,
Jul 22, 2023, 3:50:38 PM7/22/23
to ansible...@googlegroups.com
Given that the OP is using YUM resource, very likely a RHEL-like distribution, which certainly meant RHEL 8, since the NTP daemon appears to be no longer supported in that version.

--
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 ansible-proje...@googlegroups.com.

Todd Lewis

unread,
Jul 22, 2023, 3:52:38 PM7/22/23
to Ansible Project
In that case (RHEL8), definitely `chrony`.

Dick Visser

unread,
Jul 22, 2023, 6:20:19 PM7/22/23
to ansible...@googlegroups.com
So, concluding, nothing in this thread is ansible related, but OS
specific package convention related instead :)
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5b0bd5f9-e83a-4201-babe-7a39616b570fn%40googlegroups.com.

arjungoel 1995

unread,
Jul 23, 2023, 10:36:15 AM7/23/23
to ansible...@googlegroups.com
I have tried Chrony as well but same issue persists.

--

Thanh Nguyen Duc

unread,
Jul 23, 2023, 11:37:52 AM7/23/23
to ansible...@googlegroups.com
Try it locally by command: yum install ntpd or chrony or dnf install chrony ansible just help you to install it remotely. The error come from your local host.

On 23 Jul 2023, at 22:36, arjungoel 1995 <arjung...@gmail.com> wrote:



Richard Megginson

unread,
Jul 23, 2023, 12:51:56 PM7/23/23
to ansible...@googlegroups.com
If you need to manage time synchronization on an EL system (RHEL6-RHEL9, CentOS, Fedora) then I strongly encourage you to use the timesync system role https://github.com/linux-system-roles/timesync/, available in the fedora.linux_system_roles collection https://galaxy.ansible.com/fedora/linux_system_roles, and maintained by Miroslav Lichvar, the maintainer of chrony - this will take care of installing the right packages, managing the right services, etc.

Rilindo Foster

unread,
Jul 23, 2023, 1:53:21 PM7/23/23
to ansible...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages