Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/run_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
command: "{{ ios_command }}"
parser: "{{ parser }}"
engine: "{{ ios_parser_engine | default(None) }}"
name: "{{ ios_name | default(None) }} "
name: "{{ ios_name | default(None) }}"
with_first_found:
- files:
- "{{ ios_parser }}"
Expand Down
5 changes: 5 additions & 0 deletions parser_templates/cli/show_ntp_config.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Value SERVER (\S+)

Start
^ntp server\s${SERVER} -> Record
^ ntp server\s${SERVER} -> Record
7 changes: 7 additions & 0 deletions tasks/config_manager/load.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
- name: initialize function
include_tasks: includes/init.yaml

# if the configuration is provide via a list of templates, load the configuration contents and
# hand off config_manager_text.
- name: load config file templates
set_fact:
config_manager_text: "{{ lookup('template', 'config_sections.j2') }}"
when: config_manager_templates is defined

- name: validate config_manager_text is defined
fail:
msg: "missing required arg: config_manager_text"
Expand Down
3 changes: 3 additions & 0 deletions templates/config_sections.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for template in config_manager_templates %}
{% include template + '.j2' %}
{% endfor %}
27 changes: 27 additions & 0 deletions templates/ntp.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{#
get_facts with subset ntp will get current ntp servers for removal
if they aren't in your variable list.

-- required vars --
ntp:
source:
servers:
-

#}
{% if ntp_servers is defined %}
{% set current_ntp_config = ntp_servers %}
{% endif %}
{% if (ntp.source is defined) and (ntp.source) %}
ntp source {{ ntp.source }}
{% endif %}
{% if current_ntp_config is defined %}
{% for existing_server in current_ntp_config %}
{% if existing_server['SERVER'] not in ntp.servers %}
no ntp server {{ existing_server['SERVER'] }}
{% endif %}
{% endfor %}
{% endif %}
{% for server in ntp.servers %}
ntp server {{ server }}
{% endfor %}
8 changes: 8 additions & 0 deletions vars/get_facts_command_map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@
- all
- vrf
- routing

- command: show ntp config
engine: textfsm_parser
parser: show_ntp_config.template
name: ntp_servers
groups:
- all
- ntp