Any help is highly appreciated!
On Tue, Sep 18, 2018 at 11:54 AM Krishna N wrote:
> Hi Jason,
> Thanks for replying. That's definitely another way of doing it. However,
> this is what I am trying.
>
> 1. Get the ntp server config from "sh run".
> 2. Store that to a list
> 3. Jinja template
Hi Jason,
Thanks for replying. That's definitely another way of doing it. However,
this is what I am trying.
1. Get the ntp server config from "sh run".
2. Store that to a list
3. Jinja template generates the required config. I am passing the
ntp_server IPs via -e (extra variables).
4. Add the
I’m not sure how to make it work how you have laid out. But I would do the
check in the jinja template anyway. Get your current ntp lines. In the
jinja template run.
{% for ntp_server in ntp_config_get %}
{% if ntp_line not in ntp_servers %}
no ntp server {{ ntp_server }}
{% ending %}
{% for
Greetings!
How to compare when items are not in jinja template loop?
with_items: "{{ runconfser.stdout_lines[0] }}"
when: (item not in {src: 'ntprequired.j2'} and (item!=""))
ios_config:
lines:
- "no {{ item }}"
I am using roles.
*/templates/ntprequired.j2*:
{% for