嵌套 Puppet 资源

嵌套 Puppet 资源

我最近安装了一个 puppetmaster,并尝试配置一个带有嵌套资源的 puppet 类。例如。

class base {
     user { 'testuser':
            name => 'test',
            ensure => present,
            comment => 'Test User',
            expiry => '2014-06-30',
            gid => '100',
            groups => 'wheel',
            password_max_age => "60",
            managehome => true,
            shell => "/bin/bash",
            password => '*password*',
            exec {
              "usermod -p '${password}' ${user}":
                    onlyif => "egrep -q '^${user}:[*!]' /etc/shadow",
                    require => User[$user],
                 },
           }
}

问题是我一直收到语法错误:

 [root@puppetclient ~]# puppet agent -t \\
 Info: Retrieving plugin
 Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at '{'; expected '}' at /etc/puppet/environments/dev/modules/base/manifests/init.pp:13 on node puppetclient
 Warning: Not using cache on failed catalog
 Error: Could not retrieve catalog; skipping run

我错过了什么?

答案1

资源不能嵌套。它们只能相互依赖。

相关内容