OK, heres what I am trying to accomplish and I have a couple of issues 
with this....

I have a mysql module, and other modules that require mysql users to be 
set up, I thought I had this cracked with the following:

# modules/mysql/manifests/init.pp

class mysql {

        ... package and service definitions ...

}


define mysql::grant (
         user            =       "",
         password        =       "",
         privs           =       "ALL",
         objects         =       "*.*",
         host            =       "%"
) {

         exec { "mysqlgrant":
                 require =>      Service["mysql"],
                 unless  =>      "echo \"SHOW GRANTS FOR 
'$user'@'$host'\" | mysql -u root -p$mysqlrootpassword",
                 command =>      "echo \"GRANT $privs ON $objects TO 
'$user'@'$host' IDENTIFIED BY '$password'\" |  mysql -u root 
-p$mysqlrootpassword",
         }
}


... then in my other modules I'm trying to do stuff like this to a 
module that requires a mysql grant to be added....:-

# /modules/mmm/manifests/init.pp
class mmm {

         package { "mmm":
                 ensure => installed,
                 require => Service["mysql"],
         }
         mysql::grant { "mmm-user":
                 user            =>      "mmm",
                 password        =>      "password",
                 privs           =>      "ALL PRIVILEGES",
                 objects         =>      "*.*",
                 host            =>      "10.%",
         }
}

This appeared to work, until I added a similar entry to another  module, 
when I got...

err: Could not retrieve catalog: Puppet::Parser::AST::Resource failed 
with error ArgumentError: Duplicate definition: Exec[mysqlgrant] is 
already defined ....

So I'm obviously approaching this from the wrong angle.... How should I 
be doing this?


Cheers
Craig


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to