<?xml version='1.0' encoding='utf-8'?>

<creole>

    <files>
        <file name='/etc/bareos/bareosfichiers.d/mysql.conf' source='bareos-mysql.conf' filelist='mysql-bareos'/>
        <file name='/etc/rsyslog.d/eole-traps/debian-start.conf' source='rsyslog_traps_debian-start.conf' mkdir="True"/>
        <file name='/etc/logrotate.d/mysql' source='mysql.logrotate'/>
        <file name='/etc/apparmor.d/local/usr.sbin.mysqld' source="mysqld.apparmor.conf"/>
    </files>

    <containers>
        <container name="mysql" id='14'>
            <package>eole-mysql-pkg</package>
            <service servicelist='mysql'>mysql</service>
            <file filelist='mysql' name='/etc/mysql/mysql.conf.d/mysqld.cnf'/>
            <file filelist='mysql' name='/etc/mysql/conf.d/mysql_mode.cnf'/>

            <service_access service='mysql'>
                <port service_accesslist='myPort'>3306</port>
                <tcpwrapper service_accesslist='myPort'>mysqld</tcpwrapper>
            </service_access>
            <service_restriction service='mysql'>
                <ip interface='if_my_dist' interface_type="SymLinkOption" netmask='mask_my_dist' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ip_my_dist</ip>
            </service_restriction>
        </container>
    </containers>

    <variables>
        <family name='services'>
            <variable name='activer_mysql' type='oui/non' description="Activer le serveur de bases de données MySQL" >
                <value>oui</value>
            </variable>
        </family>
        <family name='mysql' mode='expert' icon='mysql-alt'>
            <variable name='mysql_max_connexions' type='number' description='Nombre maximum de connexions simultanées'>
                <value>200</value>
            </variable>
            <variable name='mysql_open_files_limit' type='number' description='Nombre maximum de fichiers ouverts en simultané'>
                <value>35000</value>
            </variable>
            <variable name='mysql_open_firewall' type='oui/non' description="Permettre l'accès au serveur depuis l'extérieur">
                <value>non</value>
            </variable>
            <variable name='ip_my_dist' type='network' description="Adresse IP réseau autorisée pour les connexions distantes au serveur MySQL" multi='True' mandatory='True'/>
            <variable name='mask_my_dist' type='netmask' description="Masque du sous réseau pour les connexions distantes au serveur MySQL" mandatory='True'/>
            <variable name='if_my_dist' type='string' description="Interface pour les connexions distantes au serveur MySQL" mandatory='True'>
                <value>auto</value>
            </variable>
            <variable name='mysql_activer_binlog' type='oui/non' description='Activer les logs binaires des transactions'>
                <value>non</value>
            </variable>
            <variable name='mysql_binlog_retention' type='number' description='Durée de rétention des logs binaires en heures'>
                <value>720</value>
            </variable>
        </family>
        <separators>
            <separator name='mysql_max_connexions'>Configuration</separator>
            <!--<separator name='ip_my_dist'>Sécurité</separator>-->
        </separators>
    </variables>

    <constraints>
        <condition name='disabled_if_in' source='activer_mysql'>
            <param>non</param>
            <target type='filelist'>mysql</target>
            <target type='filelist'>mysql-bareos</target>
            <target type='servicelist'>mysql</target>
            <target type='family'>mysql</target>
        </condition>
        <condition name='disabled_if_in' source='mysql_open_firewall'>
            <param>non</param>
            <target type='service_accesslist'>myPort</target>
            <target type='variable'>ip_my_dist</target>
            <target type='variable'>mask_my_dist</target>
            <target type='variable'>if_my_dist</target>
        </condition>
        <condition name='disabled_if_in' source='mysql_activer_binlog'>
            <param>non</param>
            <target type='variable'>mysql_binlog_retention</target>
        </condition>
        <condition name='disabled_if_in' source='activer_bareos_dir' fallback='True'>
            <param>non</param>
            <target type='filelist'>mysql-bareos</target>
        </condition>
        <check name="valid_networknetmask" target="mask_my_dist" level="warning">
            <param type='eole'>ip_my_dist</param>
        </check>
        <check name='valid_enum' target='if_my_dist'>
            <param>['auto', 'all', 'eth0', 'eth1', 'eth2', 'eth3', 'eth4']</param>
        </check>
        <group master='ip_my_dist'>
            <slave>mask_my_dist</slave>
            <slave>if_my_dist</slave>
        </group>
    </constraints>

    <help>
        <variable name='activer_mysql'>MySQL est un serveur de bases de données relationnelles SQL</variable>
        <family name='mysql'>Paramétrage avancé du serveur de gestion de bases de données MySQL</family>
        <variable name='mysql_activer_binlog'>Activation des logs binaires permettant de rejouer les transactions SQL (attention, logs volumineux).</variable>
        <variable name='mysql_binlog_retention'>Durée de rétention des logs en heures définissant un paramètre du serveur ainsi qu’une consigne de nettoyage au reconfigure (valeur maximale utilisable : 1193046).</variable>
    </help>

</creole>
<!-- vim: ts=4 sw=4 expandtab
-->
