ios_ntp

68 views
Skip to first unread message

Spiro Mitsialis

unread,
Dec 19, 2019, 4:59:02 PM12/19/19
to Ansible Project
Has anyone used ios_ntp for Cisco IOS devices?  Its new as of Ansible v2.8.  It works fine for 1 NTP server but how do you add a 2nd server.
I've tried the following and neither works.  The 2nd method works for DNS with ios_system but I guess this module is different.  Anybody have it working with multiple servers?
- ios_ntp:
    server: 10.0.255.10
    server: 10.0.255.20
- ios_ntp:
    server: 
      - 10.0.255.10
      - 10.0.255.20

Nilashish Chakraborty

unread,
Dec 20, 2019, 12:53:25 AM12/20/19
to ansible...@googlegroups.com
Hello,

The `server` key in `ios_ntp` is of type string, whereas the `domain_name`, `domain_search` and `name_servers` keys in `ios_system` are of type `list`. Hence, with ios_ntp, you need to have a separate task to add a second server.

Hope that helps.


--
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/778bb4ec-8e2a-412f-939f-a028cdd372d5%40googlegroups.com.


--

Nilashish Chakraborty

Software Engineer, Ansible

Red Hat

Nilashish Chakraborty

unread,
Dec 20, 2019, 2:45:38 AM12/20/19
to ansible...@googlegroups.com
You can also loop over a list of IP addresses in the same task. For example,

- ios_ntp:
    server: "{{ item }}"
  loop: "{{ ['192.0.2.100', '192.0.2.101'] }}"

Spiro Mitsialis

unread,
Dec 20, 2019, 8:55:33 AM12/20/19
to Ansible Project
Thanks this works.

It would be very useful if the module would work like ios_system.   If there is another DNS server in the switch config, ios_system removes it and makes sure only the server listed in the playbook remain.  
Where's the best place to put feature request?

Nilashish Chakraborty

unread,
Dec 20, 2019, 9:34:22 AM12/20/19
to ansible...@googlegroups.com
Sure. You can raise a feature request here - https://github.com/ansible/ansible/issues/new/choose.

--
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.


--

Nilashish Chakraborty

Software Engineer, Ansible

Red Hat

ncha...@redhat.com    
M: +91-8071535758    
 IM: nilashishc

Reply all
Reply to author
Forward
0 new messages