ios_ntp

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

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 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’] }}”

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?

Sure. You can raise a feature request here - https://github.com/ansible/ansible/issues/new/choose.