1

对这里的木偶很陌生。

认为:

define add_user ($shell) {
    $username = $title
    user { $username:
        shell = $shell,
    }
    group { $username:
        require => User[$username]
    }
}

和:

class zsh {
    package { 'zsh': ensure => 'installed' }
}

class bash {
    package { 'bash': ensure => 'installed' }
}

最后:

node default {
    add_user { 'foo':
        shell => '/bin/zsh'
    }
}

如何设置从用户到 shell 的要求?

4

1 回答 1

0

尝试将这样的内容添加到您的 add_user 函数中:

define add_user ($shell) {
  case $shell {
      '/bin/zsh':          { include zsh }
      '/bin/bash':         { include bash  }
      default:             { fail('Unknown Shell') }
  }
...
}
于 2013-01-18T04:26:11.273 回答