%set %%name = None
%set %%network = %%ip_network(%%nsd_reverse_network[%%rougail_index])
%for %%zone in %%nsd_zones
  %set %%suffix = %%normalize_family(%%zone)
  %set %%hostnames = %%nsd["nsd_zone_" + %%suffix]["hostname_" + %%suffix]["hostname_" + %%suffix]
  %for %%hostname in %%hostnames
    %set %%type = %%hostname['type_' + %%suffix]
    %if %%type == 'A'
      %if not %%name
%set %%name = %%str(%%zone)
$ORIGIN %%rougail_variable
$TTL 1800

@       IN      SOA     %%domain_name_eth0.      admin.%%name. (
                        0000000000              ; serial number
                        3600                    ; refresh
                        900                     ; retry
                        1209600                 ; expire
                        1800                    ; ttl
                        )
; Name servers

        IN      NS      %%domain_name_eth0.
      %end if
      %set %%ip = %%hostname['ip_' + %%suffix]
      %if %%ip_address(%%ip) in %%network
%set %%id = %%ip.rsplit('.', 1)[1]
%%id       PTR %%hostname.%%{zone}.
      %end if
    %end if
  %end for
%end for
