I'm trying to use puppet as a unix users management.
Here is the class I created to add new users:
class unix_accounts( $username, $forename, $name, $email, $uid) { user { $username: comment => '$forename $name', home => '/home/$username', shell => '/bin/bash', uid => $uid, groups => [$username, 'sudo'], }
I would like, as basically email and username ca be deduced from $name and $forename, to define these variables in the unix_accounts class. I have tried this:
$username = $forename[0].chr.downcase+name.downcase $email = $forename.downcase+'.'+$name.downcase+'@localnet.lan'
But puppetd test on client side fails out at the first dot (.) with the following message:
Error 400 on server: Syntax error at '.'; expected '}' at ....
This has nothing to do with ruby, because I have tried before with irb, it seems to be related to puppet syntax only. Is it possible anyway to created these variables inside a class? How to do that?
Many thanks