Run root password scripts only on Cluster Leaders

This commit is contained in:
Philippe Caseiro 2018-04-12 12:14:05 +02:00
parent 24aa0e14b1
commit a9da618e21
2 changed files with 8 additions and 2 deletions

View File

@ -95,8 +95,8 @@
</family> </family>
<family name="Database Cluster"> <family name="Database Cluster">
<variable name='dbClusterPosition' type='string' description="Rôle dans la grappe" mandatory='True'/>
<variable name='ifDBCluster' type='string' description="Interface réseau dédiée à la grappe BDD"/> <variable name='ifDBCluster' type='string' description="Interface réseau dédiée à la grappe BDD"/>
<!-- FIXME : Fill this variable with nom_machine --> <!-- FIXME : Fill this variable with nom_machine -->
<variable name='nodeName' type='string' description="Nom du noeud local"/> <variable name='nodeName' type='string' description="Nom du noeud local"/>
@ -137,6 +137,10 @@
<param>['Default','Custom']</param> <param>['Default','Custom']</param>
</check> </check>
<check name='valid_enum' target='dbClusterPosition'>
<param>['Leader','Node']</param>
</check>
<group master='accName'> <group master='accName'>
<slave>accLimits</slave> <slave>accLimits</slave>
<slave>accLimitTarget</slave> <slave>accLimitTarget</slave>

View File

@ -12,12 +12,14 @@ function genPasswordToFile()
chmod 600 ${file} chmod 600 ${file}
} }
ROLE=$(CreoleGet dbClusterPosition)
WRITERFILE="/root/.bddadm" WRITERFILE="/root/.bddadm"
SECURE_CMD="mysql_secure_installation" SECURE_CMD="mysql_secure_installation"
[[ ${ROLE} == "Node" ]] && exit 0
[[ -e ${WRITERFILE} ]] && exit 0 [[ -e ${WRITERFILE} ]] && exit 0
genPasswordToFile ${WRITERFILE} genPasswordToFile ${WRITERFILE}
pass=$(< ${WRITERFILE}) pass=$(< ${WRITERFILE})