Distinct naming of dhcpd macros

This commit is contained in:
RedRampage 2015-06-30 01:05:27 +03:00
parent 3d41653a3a
commit e42f56b522
2 changed files with 28 additions and 27 deletions

View File

@ -1,4 +1,4 @@
{% import 'macros.j2' as print with context %}
{% import 'macros.j2' as tpl with context %}
# {{ ansible_managed }}
{% if dhcpd_authoritative is defined and dhcpd_authoritative %}
@ -30,22 +30,22 @@ log-facility {{ dhcpd_log_facility }};
{% include 'ipxe.j2' %}
{% if dhcpd_keys is defined and dhcpd_keys %}
{% for key in dhcpd_keys %}
{{ print.key(key) }}
{{ tpl.print_key(key) }}
{% endfor %}
{% endif %}
{% if dhcpd_zones is defined and dhcpd_zones %}
{% for zone in dhcpd_zones %}
{{ print.zone(zone) }}
{{ tpl.print_zone(zone) }}
{% endfor %}
{% endif %}
{% if dhcpd_classes is defined and dhcpd_classes %}
{% for class in dhcpd_classes %}
{{ print.class(class) }}
{{ tpl.print_class(class) }}
{% endfor %}
{% endif %}
{% if dhcpd_failovers is defined and dhcpd_failovers %}
{% for failover in dhcpd_failovers %}
{{ print.failover(failover) }}
{{ tpl.print_failover(failover) }}
{% endfor %}
{% endif %}
{% if dhcpd_shared_networks is defined and dhcpd_shared_networks %}
@ -63,7 +63,7 @@ shared-network "{{ network.name }}" {
{% endif %}
{% for subnet in network.subnets %}
{{ print.subnet(subnet) | indent(8,true) }}
{{ tpl.print_subnet(subnet) | indent(8,true) }}
{% endfor %}
}
@ -72,16 +72,16 @@ shared-network "{{ network.name }}" {
{% endif %}
{% if dhcpd_groups is defined and dhcpd_groups %}
{% for group in dhcpd_groups %}
{{ print.group(group) }}
{{ tpl.print_group(group) }}
{% endfor %}
{% endif %}
{% if dhcpd_subnets is defined and dhcpd_subnets %}
{% for subnet in dhcpd_subnets %}
{{ print.subnet(subnet) }}
{{ tpl.print_subnet(subnet) }}
{% endfor %}
{% endif %}
{% if dhcpd_hosts is defined and dhcpd_hosts %}
{{ print.hosts(dhcpd_hosts) }}
{{ tpl.print_hosts(dhcpd_hosts) }}
{% endif %}
{% if dhcpd_includes is defined and dhcpd_includes %}
{% for include in dhcpd_includes %}

View File

@ -2,9 +2,10 @@
# List of macros for ISC DHCP configuration, IPv4
# ===============================================
#
# ---- Macro: print.class() ----
# ---- Macro: print_class() ----
#}
{% macro class(class) %}
{% set print = self %}
{% macro print_class(class) %}
{% if class.comment is defined and class.comment %}
# {{ class.comment }}
{% endif %}
@ -32,9 +33,9 @@ subclass "{{ class.class }}" {{ key }};
{% endmacro %}
{#
#
# ---- Macro: print.group() ----
# ---- Macro: print_group() ----
#}
{% macro group(group) %}
{% macro print_group(group) %}
{% if group.comment is defined and group.comment %}
# {{ group.comment }}
{% endif %}
@ -47,24 +48,24 @@ group {
{% endif %}
{% if group.groups is defined and group.groups %}
{% for group in group.groups %}
{{ group(group) | indent(8, true) }}
{{ print_group(group) | indent(8, true) }}
{% endfor %}
{% endif %}
{% if group.subnets is defined and group.subnets %}
{% for subnet in group.subnets %}
{{ subnet(subnet) | indent(8, true) }}
{{ print_subnet(subnet) | indent(8, true) }}
{% endfor %}
{% endif %}
{% if group.hosts is defined and group.hosts %}
{{ hosts(group.hosts) | indent(8, true) }}
{{ print_hosts(group.hosts) | indent(8, true) }}
{% endif %}
}
{% endmacro %}
{#
#
# ---- Macro: print.subnet() ----
# ---- Macro: print_subnet() ----
#}
{% macro subnet(subnet) %}
{% macro print_subnet(subnet) %}
{% if subnet.comment is defined and subnet.comment %}
# {{ subnet.comment }}
{% endif %}
@ -113,15 +114,15 @@ subnet {{ subnet.subnet | ipaddr('cidr') | ipaddr('address') }} netmask 255.255.
{% endfor %}
{% endif %}
{% if subnet.hosts is defined and subnet.hosts %}
{{ hosts(subnet.hosts) | indent(8, true) }}
{{ print_hosts(subnet.hosts) | indent(8, true) }}
{% endif %}
}
{% endmacro %}
{#
#
# ---- Macro: print.hosts() ----
# ---- Macro: print_hosts() ----
#}
{% macro hosts(hosts) %}
{% macro print_hosts(hosts) %}
{% if hosts is string %}
include "{{ hosts }}";
{% else %}
@ -167,9 +168,9 @@ host {{ host.hostname }} {
{% endmacro %}
{#
#
# ---- Macro: print.failover() ----
# ---- Macro: print_failover() ----
#}
{% macro failover(failover) %}
{% macro print_failover(failover) %}
{% if failover.comment is defined and failover.comment %}
# {{ failover.comment }}
{% endif %}
@ -229,9 +230,9 @@ failover peer "{{ failover.failover }}" {
{% endmacro %}
{#
#
# ---- Macro: print.key() ----
# ---- Macro: print_key() ----
#}
{% macro key(key) %}
{% macro print_key(key) %}
{% if key.comment is defined and key.comment %}
# {{ key.comment }}
{% endif %}
@ -242,9 +243,9 @@ key {{ key.key }} {
{% endmacro %}
{#
#
# ---- Macro: print.zone() ----
# ---- Macro: print_zone() ----
#}
{% macro zone(zone) %}
{% macro print_zone(zone) %}
{% if zone.comment is defined and zone.comment %}
# {{ zone.comment }}
{% endif %}