Skip to content

Instantly share code, notes, and snippets.

@jooooooon
Forked from frbayart/mysql_user.cf
Created May 16, 2012 12:19
Show Gist options
  • Save jooooooon/2709917 to your computer and use it in GitHub Desktop.
Save jooooooon/2709917 to your computer and use it in GitHub Desktop.
mysql_user with cfengine
bundle agent mysql_user() {
vars:
any::
"users_to_check" slist => { "francois", "benoit" };
classes:
"user_is_not_here_$(users_to_check)" expression => returnszero("/usr/local/bin/mysql_user_check $(users_to_check)","noshell");
"mysql_users_check_NOK" expression => classmatch("user_is_not_here_.*");
commands:
mysql_users_check_NOK::
"/bin/echo je vais creer les users qui manquent";
reports:
mysql_users_check_NOK::
"Au moins un user MySQL manque";
cfengine::
"Le user MySQL $(users_to_check) manque"
ifvarclass => "user_is_not_here_$(users_to_check)";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment