Forum: CFEngine Help
Subject: Re: variables changing between passes
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,22924,22948#msg-22948

Try a method.

bundle agent app_db_mysql_check_root {

commands:
"/usr/bin/mysqladmin status"
repair_failed => { "set_mysql_root" };

methods:
    set_mysql_root::
    "any" usebundle => app_db_mysql_set_root;
}

bundle agent app_db_mysql_set_root
{
vars:

"newpass" string => execresult("/usr/bin/makepasswd --chars 12","noshell"),

commands:

"/usr/bin/mysqladmin --password= password $(newpass)"
}


This keeps the latter bundle out of your bundlesequence.

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to