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.
On Sun, Jul 23, 2023 at 9:37 AM Thanh Nguyen Duc <[email protected]> wrote: > 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 <[email protected]> wrote: > > > I have tried Chrony as well but same issue persists. > > On Sun, Jul 23, 2023 at 1:15 AM Todd Lewis <[email protected]> wrote: > >> Maybe chrony rather than ntp? What OS is your target host running? >> >> On Saturday, July 22, 2023 at 3:27:11 PM UTC-4 arjungoel 1995 wrote: >> >>> 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. >>> >> -- >> 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 view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/b2c97345-e157-492e-bcff-a345002060d2n%40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/b2c97345-e157-492e-bcff-a345002060d2n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CALh2VPJkCPS4wjJMq967LD9HpfeH7FaQ8-%3DXL2CAkrnbuHDQtw%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CALh2VPJkCPS4wjJMq967LD9HpfeH7FaQ8-%3DXL2CAkrnbuHDQtw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/5592C7E5-287F-472E-B6D8-0A82DA794574%40gmail.com > <https://groups.google.com/d/msgid/ansible-project/5592C7E5-287F-472E-B6D8-0A82DA794574%40gmail.com?utm_medium=email&utm_source=footer> > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CALF5A-JA4djFQH2_rqGfex28n4Ucmnb3o%3D5BNKTOrK3AmcFpQA%40mail.gmail.com.
