%def return_yesno(%%varname)
    %if %%getVar(%%varname, 'non') == 'oui'
yes
    %else
no
    %end if
%end def
[eole]
nom_machine = %%nom_machine
eole_module = %%eole_module
eole_version = %%eole_version
eole_release = %%eole_release
mode_conteneur_actif = %%return_yesno('mode_conteneur_actif')%slurp
nombre_interfaces = %%nombre_interfaces
%for %%i in %%range(0, 5)
    %if %%i < %%int(%%nombre_interfaces)
nom_zone_eth%%i = %%getVar('nom_zone_eth' + str(%%i))
    %else
nom_zone_eth%%i = ''
    %end if
%end for
has_adresse_ip_gw = %slurp
%if %%is_empty(%%adresse_ip_gw)
no
%else
yes
%end if
adresse_ip_annuaire = %%getVar('adresse_ip_annuaire', '127.0.0.1')
adresse_ip_mail = %%getVar('adresse_ip_mail', '127.0.0.1')
adresse_imap = %%getVar('adresse_imap', '')
adresse_ip_service_web = %slurp
%if %%getVar('container_ip_web', '127.0.0.1') == '127.0.0.1'
%%adresse_ip_eth0
%else
%%container_ip_web
%end if
has_type_amon = %slurp
%if %%is_empty(%%getVar('type_amon', ''))
no
%else
yes
%end if
groups = %%custom_join(%%creole_client.get_groups())
adresse_ip_dns = %slurp
%if %%getVar("ad_address", "")
%%ad_address %slurp
  %if %%getVar("ad_rescue", "")
%%ad_rescue %slurp
  %end if
%end if
%%custom_join(%%adresse_ip_dns)
%if %%getVar("ad_server_role", "") == "controleur de domaine" or %%getVar("ad_local", "") == "oui"
is_ad_domain_controller = true
%else
is_ad_domain_controller = false
%end if
test_distant_domaine = %%custom_join(%%test_distant_domaine)
activer_proxy_client = %%return_yesno('activer_proxy_client')%slurp
proxy_client_adresse%slurp
%if %%activer_proxy_client == 'oui'
 = %%proxy_client_adresse
%else

%end if
proxy_client_port%slurp
%if %%activer_proxy_client == 'oui'
 = %%proxy_client_port
%else

%end if
adresse_ip_mysql = %%getVar('adresse_ip_mysql', 'localhost')
container_ip_dns%slurp
%if %%getVar('container_ip_dns', '') != ''
 = %%container_ip_dns
%else

%end if
adresse_ip_fichier = %%getVar('adresse_ip_fichier', 'localhost')
nom_machine_eth =%slurp
%if %%nombre_interfaces == '1'
 %%nom_machine
%else
%for %%i in range(1, %%int(%%nombre_interfaces))
 %%getVar('nom_machine_eth' + %%str(%%i), '')%slurp
%end for

%end if
cert_type = %%cert_type
server_cert = %%server_cert
server_pem = %%server_full_chain_pem
le_certificates = %slurp
%if %%cert_type == 'letsencrypt'
%for %%domainname in %%le_extra_names
%%le_config_dir/live/%%domainname/cert.pem %slurp
%end for
%if %%getVar('activer_revprox', 'non') == "oui" and %%revprox_activate_http == "oui"
%for %%domainname in %%revprox_domainname
%if %%domainname.revprox_domain_wildcard == 'non' and %%domainname.revprox_le_cert == 'oui'
%%le_config_dir/live/%%domainname/cert.pem %slurp
%end if
%end for
%end if
%end if


[service]
activer_clam = %%return_yesno('activer_clam')%slurp
activer_cups = %%return_yesno('activer_cups')%slurp
activer_dhcp = %%return_yesno('activer_dhcp')%slurp
activer_firewall = %%return_yesno('activer_firewall')%slurp
%set %%_activer_bareos_dir = %%getVar('activer_bareos_dir', 'non') == 'oui'
activer_bareos_dir = %slurp
%if %%_activer_bareos_dir
yes
%else
no
%end if
%set %%_activer_bareos_sd = %%getVar('activer_bareos_sd', 'non') == 'oui'
activer_bareos_sd = %slurp
%if %%_activer_bareos_sd
yes
%else
no
%end if
install_rvp = %%return_yesno('install_rvp')%slurp
%set %%_activer_nut = %%getVar('activer_nut', 'non') == 'oui'
activer_nut = %slurp
%if %%_activer_nut
yes
%else
no
%end if
%set _activer_sso_local = %%getVar('activer_sso', 'non') == 'local'
activer_sso_local = %slurp
%if %%_activer_sso_local
yes
%else
no
%end if
activer_filtrage_proxy = %%return_yesno('activer_filtrage_proxy')%slurp
smb_vscan = %%return_yesno('smb_vscan')%slurp
activer_client_ldap_local = %slurp
%if %%getVar('activer_client_ldap', 'non') == 'local'
yes
%else
no
%end if
activer_spamassassin = %%return_yesno('activer_spamassassin')%slurp
activer_courier_pop = %%return_yesno('activer_courier_pop')%slurp
activer_courier_imap = %%return_yesno('activer_courier_imap')%slurp
activer_apache = %%return_yesno('activer_apache')%slurp
activer_squid2 = %%return_yesno('activer_squid2')%slurp
activer_haute_dispo = %%getVar('activer_haute_dispo', 'non')
activer_mysql = %%return_yesno('activer_mysql')%slurp
activer_proftpd = %%return_yesno('activer_proftpd')%slurp
activer_squid_auth = %%return_yesno('activer_squid_auth')%slurp
activer_radius = %%return_yesno('activer_freeradius')%slurp
activer_ead_web = %%return_yesno('activer_ead_web')%slurp
activer_sympa = %%return_yesno('activer_sympa')%slurp
activer_postgresql= %%return_yesno('activer_postgresql')%slurp
horus_frontend= %%return_yesno('horus_frontend')%slurp
%if %%_activer_bareos_dir or %%_activer_bareos_sd

[bareos]
bareos_mon_password = %%creole_client.get('bareos.monitor.bareos_mon_password')
%end if
%if %%_activer_nut

[nut]
nut_ups_name = %slurp
    %if %%nut_ups_daemon == 'oui'
%%custom_join(%%nut_ups_name)
    %else
%%custom_join(%%nut_monitor_foreign_name)
    %end if
nut_ups_host =%slurp
    %if %%nut_ups_daemon == 'oui'
        %for %%tmp in %%nut_ups_name
 localhost%slurp
        %end for

    %else
        %for %%tmp in %%nut_monitor_foreign_name
 %%tmp.nut_monitor_foreign_host%slurp
        %end for

    %end if
%end if
%if %%_activer_sso_local

[sso]
eolesso_host = %%eolesso_adresse
eolesso_cas_folder = %%eolesso_cas_folder
eolesso_port = %%eolesso_port
%end if

[proxy]
%if %%getVar('activer_filtrage_proxy', None) is None
container_ip_proxy
adresse_ip_service_proxy
nom_machine_proxy
interface_proxy
maxchildren1
maxchildren2
dansguardian_eth
proxy2_port
%else
container_ip_proxy = %%getVar('container_ip_proxy', '')
    %if %%nombre_interfaces == '1'
        %set %%interf = '0'
    %else
        %set %%interf = '1'
    %end if
%set %%ip_proxy = []
    %if %%interf == '0'
        %if %%mode_conteneur_actif == 'oui'
%%ip_proxy.append(%%adresse_ip_eth0_proxy_link)%slurp
        %else
%%ip_proxy.append(%%adresse_ip_eth0)%slurp
        %end if
    %else
        %for %%i in range(1, %%int(%%nombre_interfaces))
            %if %%mode_conteneur_actif == 'oui'
%%ip_proxy.append(%%getVar('adresse_ip_eth' + %%str(%%i) + '_proxy_link'))%slurp
            %else
%%ip_proxy.append(%%getVar('adresse_ip_eth' + %%str(%%i)))%slurp
            %end if
        %end for
    %end if
adresse_ip_service_proxy = %%custom_join(%%ip_proxy)
proxy2_port = %%getVar('proxy2_port', '')
    %if %%interf == '0'
nom_machine_proxy = %%getVar('nom_machine')
    %else
nom_machine_proxy = %%getVar('nom_machine_eth' + %%interf, '')
    %end if
interface_proxy = %%interf
maxchildren1 = %%getVar('guardian_httpworkers1', 0)
maxchildren2 = %%getVar('guardian_httpworkers2', 0)
%set %%ethpolicies = []
    %if %%getVar('activer_filtrage_proxy', 'non') == 'oui'
        %if %%nombre_interfaces == '1'
%%ethpolicies.append(%%getVar('dansguardian_eth0', 0))%slurp
        %else
            %for %%i in %%range(1, %%int(%%nombre_interfaces))
%%ethpolicies.append(%%getVar('dansguardian_eth' + %%str(%%i)))%slurp
            %end for
        %end if
    %end if
dansguardian_eth = %%custom_join(%%ethpolicies)
%end if

[rvp]
%if %%getVar('install_rvp', 'non') == 'oui'
sw_threads = %%sw_threads
%else
sw_threads = 0
%end if

[haute_dispo]
nom_machine_maitre = %%getVar('nom_machine_maitre', '')
nom_machine_esclave = %%getVar('nom_machine_esclave', '')

[hapy]
ip_sunstone = %%getVar('ip_sunstone', '')
vnc_proxy_port_sunstone = %%getVar('one_sunstone_vnc_proxy_port', '')
port_sunstone = %%getVar('port_sunstone', '')
activer_oneflow = %%return_yesno('activer_oneflow')%slurp
ip_oneflow = %%getVar('ip_oneflow', '')
port_oneflow = %%getVar('port_oneflow', '')
