Compare commits
14 Commits
pkg/dev/eo
...
pkg/dev/eo
Author | SHA1 | Date | |
---|---|---|---|
eb6854d313 | |||
3cbfed8f2d | |||
d138e0715b | |||
c723edd095 | |||
1cb8566c7b | |||
37e5cbb3b2 | |||
f740f8b2bc | |||
91bdf0cbe6 | |||
4d00207271 | |||
1dc370fb94 | |||
5e98dafab2 | |||
2f4eca027a | |||
1fb5fd21b8 | |||
a9da618e21 |
@ -95,8 +95,8 @@
|
||||
</family>
|
||||
|
||||
<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"/>
|
||||
|
||||
<!-- FIXME : Fill this variable with nom_machine -->
|
||||
<variable name='nodeName' type='string' description="Nom du noeud local"/>
|
||||
|
||||
@ -137,6 +137,10 @@
|
||||
<param>['Default','Custom']</param>
|
||||
</check>
|
||||
|
||||
<check name='valid_enum' target='dbClusterPosition'>
|
||||
<param>['Leader','Node']</param>
|
||||
</check>
|
||||
|
||||
<group master='accName'>
|
||||
<slave>accLimits</slave>
|
||||
<slave>accLimitTarget</slave>
|
||||
|
@ -2,16 +2,14 @@
|
||||
|
||||
db=$(CreoleGet dbEnable non)
|
||||
cluster=$(CreoleGet dbEnableCluster non)
|
||||
role=$(CreoleGet dbClusterPosition 'Node')
|
||||
gstateFile="/var/lib/mysql/grastate.dat"
|
||||
|
||||
if [[ ${db} == "oui" ]]
|
||||
then
|
||||
if [[ ${cluster} == "oui" ]]
|
||||
then
|
||||
if [[ ! -e ${gstateFile} ]]
|
||||
then
|
||||
galera_new_cluster
|
||||
fi
|
||||
[[ ${role} == "Leader" ]] && galera_new_cluster
|
||||
fi
|
||||
fi
|
||||
|
||||
|
29
preservice/25-bdd-init
Normal file
29
preservice/25-bdd-init
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Initialize root password
|
||||
# and secure MariaDB installation
|
||||
#
|
||||
|
||||
ROLE=$(CreoleGet dbClusterPosition 'Leader')
|
||||
SECURE_CMD="mysql_secure_installation"
|
||||
PASSWORD=$(pwgen -1 10)
|
||||
passwd="/usr/share/eole/sbin/mariadbPwd"
|
||||
logfile="/var/log/eole/maria-init.log"
|
||||
|
||||
if [[ ${ROLE} == "Leader" ]]
|
||||
then
|
||||
${passwd} ${PASSWORD}
|
||||
|
||||
# Run secure installation script
|
||||
${SECURE_CMD} > ${logfile} 2>&1 <<__EOF__
|
||||
${PASSWORD}
|
||||
y
|
||||
n
|
||||
y
|
||||
y
|
||||
y
|
||||
y
|
||||
__EOF__
|
||||
else
|
||||
exit 0
|
||||
fi
|
@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Initialize root password
|
||||
# and secure MariaDB installation
|
||||
#
|
||||
|
||||
function genPasswordToFile()
|
||||
{
|
||||
local file=${1}
|
||||
pwgen -1 10 > ${file}
|
||||
chmod 600 ${file}
|
||||
}
|
||||
|
||||
WRITERFILE="/root/.bddadm"
|
||||
SECURE_CMD="mysql_secure_installation"
|
||||
|
||||
|
||||
[[ -e ${WRITERFILE} ]] && exit 0
|
||||
|
||||
genPasswordToFile ${WRITERFILE}
|
||||
|
||||
pass=$(< ${WRITERFILE})
|
||||
|
||||
# Run secure installation script
|
||||
${SECURE_CMD} <<__EOF__
|
||||
|
||||
y
|
||||
${pass}
|
||||
${pass}
|
||||
y
|
||||
y
|
||||
y
|
||||
y
|
||||
__EOF__
|
28
scripts/mariadbPwd
Normal file
28
scripts/mariadbPwd
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Renew MariaDB root password
|
||||
# Just like old (mysql_pwd.py)
|
||||
#
|
||||
cmd="mysql"
|
||||
options='--defaults-file=/etc/mysql/debian.cnf'
|
||||
|
||||
role=$(CreoleGet dbClusterRole 'Leader')
|
||||
|
||||
if [[ ${role} == "Leader"]]
|
||||
then
|
||||
if [[ -z ${1} ]]
|
||||
then
|
||||
read -s -p "New Password : " password
|
||||
echo
|
||||
else
|
||||
password="${1}"
|
||||
fi
|
||||
|
||||
sql="FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY '${password}';"
|
||||
|
||||
${cmd} ${options} -e "${sql}"
|
||||
exit $?
|
||||
else
|
||||
echo "This command don't work in a MariaDB Cluster Node, try in the Leader"
|
||||
exit 3
|
||||
fi
|
Reference in New Issue
Block a user