Puppet:根据参数要求包

时间:2013-01-17 15:49:53

标签: puppet

这里的傀儡很新。

假设:

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的要求?

1 个答案:

答案 0 :(得分:0)

尝试在add_user函数中添加类似的内容:

define add_user ($shell) {
  case $shell {
      '/bin/zsh':          { include zsh }
      '/bin/bash':         { include bash  }
      default:             { fail('Unknown Shell') }
  }
...
}