Hi,
I''m banging my head against the usage of variables i defines. Fx. I
have this defined to easily create new systemusers:
define systemuser($home = $home, $shell = "/bin/bash") {
group { $name:
ensure => present
}
user { $name:
ensure => present,
gid => $name,
home => $home,
shell => $shell,
require => Group[$name]
}
file { "$home":
ensure => directory,
owner => $name,
group => $name,
mode => 755,
require => User[$name]
}
file { "$home/.ssh":
ensure => directory,
owner => $name,
group => $name,
mode => 700,
require => File[$home]
}
remotefile { "$home/.ssh/authorized_keys":
source => "sshkeys/$name",
mode => 600,
owner => $name,
group => $name,
require => File[$home]
}
}
I can call it with:
systemuser { newusername:
home => "/home/newusername"
}
remotefile is a previously defined resource. So I''m using a defined
resource inside a new defined resource. It works fine, creates the
user, group, homedir, ssh dir, and authorized_keys file. But it seems
that I can''t say:
source => "sshkeys/$name_rsa.pub"
in the remotefile statement - puppet can''t find the file then.
It''s
not a big deal, but it''s annoying and prone to errors that is hard to
track down.
How can variables be used in ways like this? Are there any restrictions?
--
Med venlig hilsen
Juri Rischel Jensen
Fab:IT ApS
Vesterbrogade 50
DK-1620 København
Tlf: 70 202 407 / Fax: 33 313 640
www.fab-it.dk / juri@fab-it.dk