From b62bb23790b00ff3c47007e795c9684ea2551a7c Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Fri, 24 Sep 2021 14:04:48 +0200 Subject: [PATCH] . --- salt/modules/_states/mysql.py | 8 ++++---- salt/states/mariadb/init.sls | 3 ++- salt/states/top.sls | 1 + update.sh | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/salt/modules/_states/mysql.py b/salt/modules/_states/mysql.py index 14872a8..848e43f 100644 --- a/salt/modules/_states/mysql.py +++ b/salt/modules/_states/mysql.py @@ -1,6 +1,6 @@ import salt.exceptions -def root_password(name): +def root_password(name, password): """ Set the mysql/mariadb root password @@ -8,18 +8,18 @@ def root_password(name): the password to user for root """ ret = { - "name": "root password", + "name": name, "changes": {}, "result": False, "comment": "" } - if __salt__["mysql.check_credentials"]("root", name): + if __salt__["mysql.check_credentials"]("root", password): ret["comment"]="Password is in correct state" ret["result"] = True return ret - result = __salt__["mysql.set_root_password"](name) + result = __salt__["mysql.set_root_password"](password) if not result["result"]: ret["comment"] = result["err"] return ret diff --git a/salt/states/mariadb/init.sls b/salt/states/mariadb/init.sls index b25d147..02b4ac8 100644 --- a/salt/states/mariadb/init.sls +++ b/salt/states/mariadb/init.sls @@ -9,4 +9,5 @@ Start mariadb: Check Root password: mysql.root_password: - - name: {{ pillar['mariadb']['root_password'] }} + - name: root + - password: {{ pillar['mariadb']['root_password'] }} diff --git a/salt/states/top.sls b/salt/states/top.sls index 6a14fb5..f2d831c 100644 --- a/salt/states/top.sls +++ b/salt/states/top.sls @@ -6,3 +6,4 @@ base: - atftp - dnsmasq - nginx + - mariadb diff --git a/update.sh b/update.sh index cc89644..86d127a 100755 --- a/update.sh +++ b/update.sh @@ -89,7 +89,7 @@ function check_prerequisites(){ } function do_salt_call(){ - local salt="sudo salt-call --local --file-root $SCRIPTDIR/salt/states --pillar-root $SCRIPTDIR/salt/pillars" + local salt="sudo salt-call --local --file-root $SCRIPTDIR/salt/states --pillar-root $SCRIPTDIR/salt/pillars --module-dirs=$SCRIPTDIR/salt/modules" new_log "Running salt high state" if asktobreak;then return