回答:
今日も同様のリクエストに遭遇しましたが、他の方法で解決できるのであれば、私は幹部のファンではありません。そこで、別のパスを選択し、「yumgroup」用の単純なカスタムタイプを作成しました。これらのファイルをモジュールパスの任意のモジュールに配置するだけです。
「モジュール名/lib/puppet/provider/yumgroup/default.rb」
Puppet::Type.type(:yumgroup).provide(:default) do
  desc 'Support for managing the yum groups'
  commands :yum => '/usr/bin/yum'
  # TODO
  # find out how yum parses groups and reimplement that in ruby
  def self.instances
    groups = []
    # get list of all groups
    yum_content = yum('grouplist').split("\n")
    # turn of collecting to avoid lines like 'Loaded plugins'
    collect_groups = false
    # loop through lines of yum output
    yum_content.each do |line|
      # if we get to 'Available Groups:' string, break the loop
      break if line.chomp =~ /Available Groups:/
      # collect groups
      if collect_groups and line.chomp !~ /(Installed|Available)/
        current_name = line.chomp.sub(/^\s+/,'\1').sub(/ \[.*\]/,'')
        groups << new(
          :name   => current_name,
          :ensure => :present
        )
      end
      # turn on collecting when the 'Installed Groups:' is reached
      collect_groups = true if line.chomp =~ /Installed Groups:/
    end
    groups
  end
  def self.prefetch(resources)
    instances.each do |prov|
      if resource = resources[prov.name]
        resource.provider = prov
      end
    end
  end
  def create
    yum('-y', 'groupinstall', @resource[:name])
    @property_hash[:ensure] == :present
  end
  def destroy
    yum('-y', 'groupremove', @resource[:name])
    @property_hash[:ensure] == :absent
  end
  def exists?
    @property_hash[:ensure] == :absent
  end
end
「モジュール名/lib/puppet/type/yumgroup.rb」
Puppet::Type.newtype(:yumgroup) do
@doc = "Manage Yum groups
A typical rule will look like this:
yumgroup { 'Development tools':
  ensure => present,
}
"
    ensurable
    newparam(:name) do
       isnamevar
       desc 'The name of the group'
    end
end
その後、pluginsyncを有効にしてpuppetエージェントを実行すると、次のようなカスタムタイプを使用できます。
yumgroup {'Base': ensure => present, }
または:
yumgroup {'Development tools': ensure => absent, }
また、次のコマンドを実行すると、インストールされているグループを確認できます。
puppet resource yumgroup
楽しい!
以下は、「yumgroup」パペットリソースタイプの定義です。デフォルトで必須パッケージと必須パッケージをインストールし、オプションパッケージをインストールできます。
この定義では、yumグループを削除することはできませんが、簡単に実行できます。特定の状況下で人形のループを引き起こす可能性があるので、私は気にしませんでした。
このタイプでは、yum-downloadonly rpmをインストールする必要があり、RHEL / CentOS / SL 6でのみ機能すると思います。これを書いたとき、以前のバージョンでのyumの終了ステータスが間違っていたため、「unless」パラメーターが機能しませんでした出力用のgrepに拡張されることなく。
define yumgroup($ensure = "present", $optional = false) {
   case $ensure {
      present,installed: {
         $pkg_types_arg = $optional ? {
            true => "--setopt=group_package_types=optional,default,mandatory",
            default => ""
         }
         exec { "Installing $name yum group":
            command => "yum -y groupinstall $pkg_types_arg $name",
            unless => "yum -y groupinstall $pkg_types_arg $name --downloadonly",
            timeout => 600,
         }
      }
   }
}
他のマニフェストと競合する可能性があるため、yum-downloadonlyを依存関係にすることを意図的に省略しました。これを行う場合は、yum-downloadonlyパッケージを別のマニフェストで宣言し、この定義に含めます。この定義で直接宣言しないでください。宣言しないと、このリソースタイプを複数回使用すると、puppetはエラーを出します。次に、execリソースはPackage ['yum-downloadonly']を必要とします。
class yum_groupinstalls {     yumgroup { '"Development tools"': } }  定義では、CentOS 6.2では/ usr / bin / yumであるyumへのフルパスを指定する必要がありました。
                    PackageタイプのPuppetタイプリファレンスで何も見つからなかったため、FreenodeのPuppet IRCチャネル(#puppet、奇妙なことに)に尋ねたところ、何も得られなかったので、答えは「まだ」ではないと思います。
Puppet Exec Typeを介してこれを処理し、必要なグループインストールを実行できます。必要なときにだけ実行されるように、または常に実行されないようにを介してトリガーしてトリガーするように、good onlyifまたはunlessoptionを必ず含めます。あなたはそれがトリガーされた提供のためにタイプがpuppetクライアント上でローカルにコマンドを実行します。refreshonlyNotifyExec
カスタムリソースを使用したソリューションが好きですが、べき等ではありません。私の存在は?関数:
Puppet::Type.type(:yumgroup).provide(:default) do
  desc 'Support for managing the yum groups'
  commands :yum => '/usr/bin/yum'
  # TODO
  # find out how yum parses groups and reimplement that in ruby
  def self.instances
    groups = []
    # get list of all groups
    yum_content = yum('grouplist')
    # turn of collecting to avoid lines like 'Loaded plugins'
    collect_groups = false
    # loop through lines of yum output
    yum_content.each do |line|
      # if we get to 'Available Groups:' string, break the loop
      break if line.chomp =~ /Available Groups:/
      # collect groups
      if collect_groups and line.chomp !~ /(Installed|Available)/
        current_name = line.chomp.sub(/^\s+/,'\1').sub(/ \[.*\]/,'')
        groups << new(
          :name   => current_name,
          :ensure => :present
        )
      end
      # turn on collecting when the 'Installed Groups:' is reached
      collect_groups = true if line.chomp =~ /Installed Groups:/
    end
    groups
  end
  def self.prefetch(resources)
    instances.each do |prov|
      if resource = resources[prov.name]
        resource.provider = prov
      end
    end
  end
  def create
    yum('-y', 'groupinstall', @resource[:name])
    @property_hash[:ensure] == :present
  end
  def destroy
    yum('-y', 'groupremove', @resource[:name])
    @property_hash[:ensure] == :absent
  end
  def exists?
    cmd = "/usr/bin/yum grouplist hidden \"" + @resource[:name] + "\" | /bin/grep \"^Installed\" > /dev/null"
    system(cmd)
    $?.success?
  end
end
yum_content = yum('grouplist')、.split("\n")それが必要だと思います.each。