guyzdm@googlemail.com
2007-Oct-02 12:28 UTC
Requires from other modules / requires with aliases
Hi everyone, I''ve been working on a module for bacula, and I''m
having
a problem requiring resources I''ve defined in other modules. At the
moment, I have the following (simplified):
/etc/puppet/modules/bacula/manifests/init.pp:
class bacula {
...
define configure ( $gui="true", $db_password ) {
...
postgresql::create_db { "bacula":
alias => create_bacula_db,
require => create_bacula_user,
owner => "bacula",
}
postgresql::authorise{"bacula":
alias => authorise_bacula_user,
host => "local",
database => "bacula",
method => "md5",
require => [ create_bacula_db, set_bacula_db_password
]
}
...
service{"bacula-director" :
ensure => running,
require => [
File["/etc/bacula/bacula-dir.conf"], authorise_bacula_user]
}
...
postgresql::create_user and postgresql::create_db are defines in the
postgresql module. Version of puppet is 0.23.2.
I wasn''t sure of the syntax to require postgresql::create_user or
create_db directly, so I tried using aliases (as above). These seem
to work between resources I''ve defined, but I''m getting an
error with
the require in the Service resource:
err: Could not create bacula-director: Parameter require failed:
Invalid relationship "authorise_bacula_user" at
/etc/puppet/modules/bacula/manifests/init.pp:119
err: Parameter require failed: Invalid relationship
"authorise_bacula_user" at
/etc/puppet/modules/bacula/manifests/init.pp:119
I tried using name => authorise_bacula_user instead of alias, with
similar results.
I also tried quoting the resource. Again it''s fine with resources
I''ve defined. This gives no errors:
postgresql::password {"set bacula db password" :
alias => set_bacula_db_password,
username => "bacula",
password => $dbpassword,
require => [
Package["bacula-director-pgsql"],
"postgresql::Create_user[''bacula'']"]
}
But with service, I get the Invalid relationship error:
service{"bacula-director" :
ensure => running,
require =>
[File["/etc/bacula/bacula-dir.conf"],
"postgresql::Authorise[''bacula'']"]
}
Any help would be greatly appreciated. Thanks, Guy
On Oct 2, 2007, at 7:28 AM, guyzdm@googlemail.com wrote:> require => [ Package["bacula-director-pgsql"], > "postgresql::Create_user[''bacula'']"]Use: require => [Package[bacula-director-pgsql], Postgresql::Create_user [bacula]] It''s kinda bad form to have a verb in a definition name, though; it makes more sense to talk about a database role or user: define postgres::role(...) { } In fact, you can look at my own code for exactly this by doing a git clone of ''git://reductivelabs.com/modules/postgres''. -- Of the thirty-six ways of avoiding disaster, running away is best. -- Chinese Proverb --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
guyzdm@googlemail.com
2007-Oct-03 15:21 UTC
Re: Requires from other modules / requires with aliases
> Use: > > require => [Package[bacula-director-pgsql], Postgresql::Create_user[bacula]]That worked - thanks very much!> It''s kinda bad form to have a verb in a definition name, though; it > makes more sense to talk about a database role or user:Okay - that makes sense...