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'] }}"

On Fri, Dec 20, 2019 at 11:22 AM Nilashish Chakraborty <[email protected]>
wrote:

> 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.
>
>
> On Fri, Dec 20, 2019 at 3:29 AM Spiro Mitsialis <[email protected]>
> wrote:
>
>> 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
>>
>>
>> --
>> 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/778bb4ec-8e2a-412f-939f-a028cdd372d5%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/778bb4ec-8e2a-412f-939f-a028cdd372d5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
>
> Nilashish Chakraborty
>
> Software Engineer, Ansible
>
> Red Hat <https://www.redhat.com/>
> <https://www.redhat.com/>
>


-- 

Nilashish Chakraborty

Software Engineer, Ansible
<https://www.redhat.com/>

-- 
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/CAJ6QEq1G66JaN4c9CWL%3DhMjvt0syLyRTdbNgPsL%3Dnfe0Dv3Pzw%40mail.gmail.com.

Reply via email to