在Site.pp中使用Puppet定义

时间:2014-11-26 13:25:05

标签: puppet

我使用以下Puppet定义来禁用Windows中的IPV6:

#IPv6 Management
define winconfig::ipv6 (
  $ensure,
  $state = UNDEF,
) {
  include winconfig::params
  case $ensure {
    'present','enabled': {
      case $state {
        UNDEF,'all': { $ipv6_data = '0' }
        'preferred': { $ipv6_data = '0x20' }
        'nontunnel': { $ipv6_data = '0x10' }
        'tunnel': { $ipv6_data = '0x01' }
        default: { $ipv6_data = '0' }
      }
    }
    'absent','disabled': { $ipv6_data = '0xffffffff' }
    default: { fail('You must specify ensure status...') }
  }
  registry::value{'ipv6':
    key    => 'hklm\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters',
    value  => 'DisabledComponents',
    type   => 'dword',
    data   => $ipv6_data,
  }
  reboot {'ipv6':
    subscribe => Registry::Value['ipv6'],
  }
}

在Master上的Site.pp中,我正在使用以下命令从节点调用它:

node 'BMSGITSS1' { 
# Disable IPV6
  winconfig::ipv6 {
    ensure => 'disabled',
  }
}

运行puppet agent -t

时出现以下错误
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could
 not parse for environment production: All resource specifications require names
; expected '%s' at /etc/puppetlabs/puppet/manifests/site.pp:55 on node bmsgitss1 
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

1 个答案:

答案 0 :(得分:3)

提示错误:

All resource specifications require names; expected '%s'

你需要给它一个名字:

winconfig::ipv6{"Disable IPv6":
  ensure => 'disabled',
}