* adding OS9 ansible collections * adding OS9 collections Co-authored-by: Patil <Komal_uttamrao_Patil@Dell.com>
422 lines
No EOL
13 KiB
Django/Jinja
422 lines
No EOL
13 KiB
Django/Jinja
#jinja2: trim_blocks: True,lstrip_blocks: True
|
|
{#############################################
|
|
|
|
Purpose:
|
|
Configure system commands for os9 Devices
|
|
|
|
os9_system:
|
|
hostname: os9
|
|
unique_hostname: true
|
|
enable_password: xxxxx
|
|
service_passwd_encryption: true
|
|
banner:
|
|
exec: t hai t
|
|
login:
|
|
ack_enable: true
|
|
ack_prompt: testbanner
|
|
keyboard_interactive: true
|
|
banner_text: cloginbannerc
|
|
motd: t ansibletest t
|
|
hash_algo:
|
|
algo:
|
|
- name: lag
|
|
mode: xor1
|
|
stack_unit: 0
|
|
port_set: 0
|
|
state: present
|
|
- name: ecmp
|
|
mode: xor1
|
|
stack_unit: 0
|
|
port_set: 0
|
|
state: present
|
|
seed:
|
|
- value: 3
|
|
stack_unit: 0
|
|
port_set: 0
|
|
state: present
|
|
- value: 2
|
|
state: present
|
|
load_balance:
|
|
ingress_port: true
|
|
ip_selection:
|
|
- field: vlan dest-ip
|
|
state: present
|
|
ipv6_selection:
|
|
- field: dest-ipv6 vlan
|
|
state: present
|
|
tunnel:
|
|
hash_field:
|
|
- name: mac-in-mac
|
|
header: tunnel-header-ipv4
|
|
state: present
|
|
clock:
|
|
summer_time:
|
|
timezone_name: PST
|
|
type: date
|
|
start_datetime: 2 jan 1991 22:33
|
|
end_datetime: 3 jan 2017 22:33
|
|
offset_mins: 20
|
|
timezone:
|
|
name: IST
|
|
offset_hours: -5
|
|
offset_mins: 20
|
|
reload_type:
|
|
auto_save: true
|
|
boot_type: normal-reload
|
|
config_scr_download: true
|
|
dhcp_timeout: 5
|
|
retry_count: 3
|
|
relay: true
|
|
relay_remote_id: host
|
|
vendor_class_identifier: aa
|
|
management_rt:
|
|
- ip: 10.16.148.254
|
|
state: present
|
|
ipv4: True
|
|
line_terminal:
|
|
vty 0:
|
|
exec_timeout: 40
|
|
exec_banner: true
|
|
vty 1:
|
|
exec_timeout: 40 200
|
|
motd_banner: true
|
|
###################################################}
|
|
{% if os9_system is defined and os9_system %}
|
|
|
|
{% if os9_system.hostname is defined and os9_system.hostname %}
|
|
hostname {{ os9_system.hostname }}
|
|
{% endif %}
|
|
{% if os9_system %}
|
|
{% for key,value in os9_system.items() %}
|
|
{% if key == "unique_hostname" %}
|
|
{% if value %}
|
|
feature unique-name
|
|
{% else %}
|
|
no feature unique-name
|
|
{% endif %}
|
|
|
|
{% elif key == "enable_password" %}
|
|
{% if value %}
|
|
enable password {{ value }}
|
|
{% else %}
|
|
no enable password
|
|
{% endif %}
|
|
|
|
{% elif key == "service_passwd_encryption" %}
|
|
{% if value %}
|
|
service password-encryption
|
|
{% else %}
|
|
no service password-encryption
|
|
{% endif %}
|
|
|
|
{% elif key == "clock" and value %}
|
|
{% if value.summer_time is defined and value.summer_time %}
|
|
{% set time_vars = value.summer_time %}
|
|
{% if time_vars.state is defined and time_vars.state == "absent" %}
|
|
no clock summer-time
|
|
{% else %}
|
|
{% if time_vars.timezone_name is defined and time_vars.timezone_name %}
|
|
{% if time_vars.type is defined and time_vars.type %}
|
|
{% if time_vars.start_datetime is defined and time_vars.start_datetime %}
|
|
{% if time_vars.end_datetime is defined and time_vars.end_datetime %}
|
|
{% if time_vars.offset_mins is defined and time_vars.offset_mins %}
|
|
clock summer-time {{ time_vars.timezone_name }} {{ time_vars.type }} {{ time_vars.start_datetime }} {{ time_vars.end_datetime }} {{ time_vars.offset_mins }}
|
|
{% else %}
|
|
clock summer-time {{ time_vars.timezone_name }} {{ time_vars.type }} {{ time_vars.start_datetime }} {{ time_vars.end_datetime }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.timezone is defined and value.timezone %}
|
|
{% set timezone_vars = value.timezone %}
|
|
{% if timezone_vars.state is defined and timezone_vars.state == "absent" %}
|
|
no clock timezone
|
|
{% else %}
|
|
{% if timezone_vars.name is defined and timezone_vars.name %}
|
|
{% if timezone_vars.offset_hours is defined and timezone_vars.offset_hours %}
|
|
{% if timezone_vars.offset_mins is defined and timezone_vars.offset_mins %}
|
|
clock timezone {{ timezone_vars.name }} {{ timezone_vars.offset_hours }} {{ timezone_vars.offset_mins }}
|
|
{% else %}
|
|
clock timezone {{ timezone_vars.name }} {{ timezone_vars.offset_hours }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
|
|
{% elif key == "hash_algo" and value %}
|
|
{% if value.algo is defined and value.algo %}
|
|
{% for item in value.algo %}
|
|
{% if item.name is defined and item.name %}
|
|
{% if item.mode is defined and item.mode %}
|
|
{% if item.state is defined and item.state == "absent" %}
|
|
{% if item.stack_unit is defined and item.stack_unit >= 0 %}
|
|
{% if item.port_set is defined and item.port_set >= 0 %}
|
|
no hash-algorithm {{ item.name }} {{ item.mode }} stack-unit {{ item.stack_unit }} port-set {{ item.port_set }}
|
|
{% else %}
|
|
no hash-algorithm {{ item.name }} {{ item.mode }} stack-unit {{ item.stack_unit }}
|
|
{% endif %}
|
|
{% else %}
|
|
no hash-algorithm {{ item.name }} {{ item.mode }}
|
|
{% endif %}
|
|
{% else %}
|
|
{% if item.stack_unit is defined and item.stack_unit >= 0 %}
|
|
{% if item.port_set is defined and item.port_set >= 0 %}
|
|
hash-algorithm {{ item.name }} {{ item.mode }} stack-unit {{ item.stack_unit }} port-set {{ item.port_set }}
|
|
{% else %}
|
|
hash-algorithm {{ item.name }} {{ item.mode }} stack-unit {{ item.stack_unit }}
|
|
{% endif %}
|
|
{% else %}
|
|
hash-algorithm {{ item.name }} {{ item.mode }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if value.seed is defined and value.seed %}
|
|
{% for item in value.seed %}
|
|
{% if item.value is defined and item.value >= 0 %}
|
|
{% if item.state is defined and item.state == "absent" %}
|
|
{% if item.stack_unit is defined and item.stack_unit >= 0 %}
|
|
{% if item.port_set is defined and item.port_set >= 0 %}
|
|
no hash-algorithm seed {{ item.value }} stack-unit {{ item.stack_unit }} port-set {{ item.port_set }}
|
|
{% else %}
|
|
no hash-algorithm seed {{ item.value }} stack-unit {{ item.stack_unit }}
|
|
{% endif %}
|
|
{% else %}
|
|
no hash-algorithm seed {{ item.value }}
|
|
{% endif %}
|
|
{% else %}
|
|
{% if item.stack_unit is defined and item.stack_unit >= 0 %}
|
|
{% if item.port_set is defined and item.port_set >= 0 %}
|
|
hash-algorithm seed {{ item.value }} stack-unit {{ item.stack_unit }} port-set {{ item.port_set }}
|
|
{% else %}
|
|
hash-algorithm seed {{ item.value }} stack-unit {{ item.stack_unit }}
|
|
{% endif %}
|
|
{% else %}
|
|
hash-algorithm seed {{ item.value }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% elif key == "banner" and value %}
|
|
{% if value.exec is defined %}
|
|
{% if value.exec %}
|
|
banner exec {{ value.exec }}
|
|
{% else %}
|
|
no banner exec
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.motd is defined %}
|
|
{% if value.motd %}
|
|
banner motd {{ value.motd }}
|
|
{% else %}
|
|
no banner motd
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.login is defined and value.login %}
|
|
{% set login_vars = value.login %}
|
|
{% if login_vars.ack_enable is defined %}
|
|
{% if login_vars.ack_enable %}
|
|
banner login acknowledgment enable
|
|
{% else %}
|
|
no banner login acknowledgment enable
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if login_vars.ack_prompt is defined %}
|
|
{% if login_vars.ack_prompt %}
|
|
banner login acknowledgment prompt {{ login_vars.ack_prompt }}
|
|
{% else %}
|
|
no banner login acknowledgment prompt
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if login_vars.keyboard_interactive is defined %}
|
|
{% if login_vars.keyboard_interactive %}
|
|
banner login keyboard-interactive
|
|
{% else %}
|
|
no banner login keyboard-interactive
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if login_vars.banner_text is defined %}
|
|
{% if login_vars.banner_text %}
|
|
banner login {{ login_vars.banner_text }}
|
|
{% else %}
|
|
no banner login
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% elif key == "load_balance" and value %}
|
|
{% if value.ingress_port is defined %}
|
|
{% if value.ingress_port %}
|
|
load-balance ingress-port enable
|
|
{% else %}
|
|
no load-balance ingress-port enable
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.tcp_udp is defined %}
|
|
{% if value.tcp_udp %}
|
|
load-balance tcp-udp enable
|
|
{% else %}
|
|
no load-balance tcp-udp enable
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.ip_selection is defined and value.ip_selection %}
|
|
{% for item in value.ip_selection %}
|
|
{% if item.field is defined and item.field %}
|
|
{% if item.state is defined and item.state == "absent" %}
|
|
no load-balance ip-selection
|
|
{% else %}
|
|
load-balance ip-selection {{ item.field }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if value.ipv6_selection is defined and value.ipv6_selection %}
|
|
{% for item in value.ipv6_selection %}
|
|
{% if item.field is defined and item.field %}
|
|
{% if item.state is defined and item.state == "absent" %}
|
|
no load-balance ipv6-selection
|
|
{% else %}
|
|
load-balance ipv6-selection {{ item.field }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if value.tunnel is defined and value.tunnel %}
|
|
{% set tunnel_vars = value.tunnel %}
|
|
{% if tunnel_vars.hash_field is defined and tunnel_vars.hash_field %}
|
|
{% for item in tunnel_vars.hash_field %}
|
|
{% if item.name is defined and item.name %}
|
|
{% if item.header is defined and item.header %}
|
|
{% if item.state is defined and item.state == "absent" %}
|
|
no load-balance tunnel {{ item.name }} {{ item.header }}
|
|
{% else %}
|
|
load-balance tunnel {{ item.name }} {{ item.header }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% elif key == "reload_type" and value %}
|
|
reload-type
|
|
{% if value.auto_save is defined %}
|
|
{% if value.auto_save %}
|
|
auto-save enable
|
|
{% else %}
|
|
auto-save disable
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.boot_type is defined and value.boot_type %}
|
|
{% if boot_type_state is defined and boot_type_state =="absent" %}
|
|
no boot-type {{ value.boot_type }}
|
|
{% else %}
|
|
boot-type {{ value.boot_type }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.config_scr_download is defined %}
|
|
{% if value.config_scr_download %}
|
|
config-scr-download enable
|
|
{% else %}
|
|
config-scr-download disable
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.dhcp_timeout is defined %}
|
|
{% if value.dhcp_timeout >=0 %}
|
|
dhcp-timeout {{ value.dhcp_timeout }}
|
|
{% else %}
|
|
no dhcp-timeout 0
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.retry_count is defined %}
|
|
{% if value.retry_count >=0 %}
|
|
retry-count {{ value.retry_count }}
|
|
{% else %}
|
|
no retry-count 0
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.relay is defined %}
|
|
{% if value.relay %}
|
|
relay enable
|
|
{% else %}
|
|
relay disable
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.relay_remote_id is defined %}
|
|
{% if value.relay_remote_id %}
|
|
relay remote-id {{ value.relay_remote_id }}
|
|
{% else %}
|
|
no relay remote-id a
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if value.vendor_class_identifier is defined %}
|
|
{% if value.vendor_class_identifier %}
|
|
vendor-class-identifier {{ value.vendor_class_identifier }}
|
|
{% else %}
|
|
no vendor-class-identifier a
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% elif key == "management_rt" and value %}
|
|
{% for item in value %}
|
|
{% if item.ip is defined and item.ip %}
|
|
{% if item.ipv4 is defined and item.ipv4 %}
|
|
{% if item.state is defined and item.state == "absent" %}
|
|
no management route 0.0.0.0/0 {{ item.ip }}
|
|
{% else %}
|
|
management route 0.0.0.0/0 {{ item.ip }}
|
|
{% endif %}
|
|
{% else %}
|
|
{% if item.state is defined and item.state == "absent" %}
|
|
no management route ::/0 {{ item.ip }}
|
|
{% else %}
|
|
management route ::/0 {{ item.ip }}
|
|
{% endif %}
|
|
{% endif%}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% elif key == "line_terminal" and value %}
|
|
{% for key in value.keys() %}
|
|
{% set vty_vars = value[key] %}
|
|
line {{ key }}
|
|
{% if vty_vars.exec_timeout is defined %}
|
|
{% if vty_vars.exec_timeout %}
|
|
{% set timeout = (vty_vars.exec_timeout | string).split(" ") %}
|
|
{% if timeout | length > 1 %}
|
|
exec-timeout {{ vty_vars.exec_timeout }}
|
|
{% else %}
|
|
exec-timeout {{ vty_vars.exec_timeout }} 0
|
|
{% endif %}
|
|
{% else %}
|
|
no exec-timeout
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if vty_vars.exec_banner is defined %}
|
|
{% if vty_vars.exec_banner %}
|
|
exec-banner
|
|
{% else %}
|
|
no exec-banner
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if vty_vars.motd_banner is defined %}
|
|
{% if vty_vars.motd_banner %}
|
|
motd-banner
|
|
{% else %}
|
|
no motd-banner
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endif %} |