48 lines
1.7 KiB
Django/Jinja
48 lines
1.7 KiB
Django/Jinja
<Request>
|
|
<Login>
|
|
<Username>{{ sophos_api_username }}</Username>
|
|
<Password>{{ sophos_api_password }}</Password>
|
|
</Login>
|
|
<Set operation="{% if item.name in existing_dhcp_servers %}update{% else %}add{% endif %}">
|
|
<DHCPServer>
|
|
<Name>{{ item.name }}</Name>
|
|
<Interface>{{ item.interface }}</Interface>
|
|
<Status>{{ 'Enable' if item.enabled | default(true) else 'Disable' }}</Status>
|
|
<StartIPAddress>{{ item.start_ip }}</StartIPAddress>
|
|
<EndIPAddress>{{ item.end_ip }}</EndIPAddress>
|
|
<Netmask>{{ item.netmask }}</Netmask>
|
|
<Gateway>{{ item.gateway }}</Gateway>
|
|
<DNSServers>
|
|
{% for dns in item.dns_servers %}
|
|
<Server>{{ dns }}</Server>
|
|
{% endfor %}
|
|
</DNSServers>
|
|
{% if item.domain is defined %}
|
|
<DomainName>{{ item.domain }}</DomainName>
|
|
{% endif %}
|
|
<LeaseTime>{{ item.lease_time | default(86400) }}</LeaseTime>
|
|
{% if item.reservations is defined and item.reservations | length > 0 %}
|
|
<Reservations>
|
|
{% for reservation in item.reservations %}
|
|
<Reservation>
|
|
<MACAddress>{{ reservation.mac_address }}</MACAddress>
|
|
<IPAddress>{{ reservation.ip_address }}</IPAddress>
|
|
<Hostname>{{ reservation.hostname | default('') }}</Hostname>
|
|
</Reservation>
|
|
{% endfor %}
|
|
</Reservations>
|
|
{% endif %}
|
|
{% if item.dhcp_options is defined and item.dhcp_options | length > 0 %}
|
|
<DHCPOptions>
|
|
{% for option in item.dhcp_options %}
|
|
<Option>
|
|
<Code>{{ option.option }}</Code>
|
|
<Value>{{ option.value }}</Value>
|
|
</Option>
|
|
{% endfor %}
|
|
</DHCPOptions>
|
|
{% endif %}
|
|
</DHCPServer>
|
|
</Set>
|
|
</Request>
|