Sure, that's perhaps misleading a little - our internal custom puppet 
module is called yum as it was created for EL6 first. When we got a package 
manager on Windows, i.e. chocolatey, it seemed to make sense to put it in 
the Windows section of the yum module. By that I mean we have a switch on 
kernel in our modules. Here's the complete module:
class yum ($choco_repo_url, $choco_repo_name) {
  schedule { 'monday_updates':
    range   => '22:00 - 12:00',
    weekday => 'Monday',
  }

  schedule { 'tuesday_updates':
    range   => '10:00 - 12:00',
    weekday => 'Tuesday',
  }

  schedule { 'daily_updates':
    period => daily,
    range  => '22:00-3:00',
  }

  define repo {
    file { "${title}":
      path   => "/etc/yum.repos.d/${title}",
      source => "puppet:///modules/${caller_module_name}/${title}",
      ensure => 'present',
      owner  => root,
      group  => root,
      mode   => "644",
      notify => Exec["yum-clean-all"],
    }

  }

  case $kernel {
    'linux'   : {
      package { 'yum': ensure => present, }

      package { 'yum-autoupdate': ensure => present, }

      repo { "sl-classe.repo": }

      file { "sl-classe-testing":
        content => template('yum/sl-classe-testing.repo.erb'),
        path    => "/etc/yum.repos.d/sl-classe-testing.repo",
        owner   => root,
        group   => root,
        mode    => 644,
        ensure  => present,
        notify  => Exec["yum-clean-all"],
      }

      file { "yum.conf":
        source => "puppet:///modules/yum/yum.conf",
        path   => "/etc/yum.conf",
        owner  => root,
        group  => root,
        mode   => 644,
        ensure => present,
      }

      file { "sl-lepp":
        path   => "/etc/yum.repos.d/sl-lepp.repo",
        ensure => absent,
      }

      file { "sl-lepp-testing":
        path   => "/etc/yum.repos.d/sl-lepp-testing.repo",
        ensure => absent,
      }

      exec { "yum-clean-all":
        command     => "yum clean all",
        refreshonly => true,
      }

      case $operatingsystemmajrelease {
        '6' : {
          $sl6repos = ["devtoolset.repo", "sl-other.repo", "sl.repo"]

          repo { $sl6repos: }

          file { "softwarecollections":
            source => "puppet:///modules/yum/sl6-softwarecollections.repo",
            path   => "/etc/yum.repos.d/softwarecollections.repo",
            owner  => root,
            group  => root,
            mode   => 644,
            ensure => present,
            notify => Exec["yum-clean-all"],
          }

          exec { "yum-autoupdate":
            command => "mv /etc/cron.daily/yum-autoupdate 
/etc/cron.weekly/yum-autoupdate",
            onlyif  => "[ -f /etc/cron.daily/yum-autoupdate ]",
          }

          file { "/etc/cron.daily/yum-autoupdate": ensure => absent, }

          file { "/etc/cron.weekly/yum-autoupdate": ensure => present, }
          Exec['yum-autoupdate'] -> File['/etc/cron.daily/yum-autoupdate'] 
-> File['/etc/cron.weekly/yum-autoupdate']

        }
        '7' : {
          packages::removepackage { "yum-conf-sl7x": }

          $sl7repos = [
            "sl7-other.repo",
            "sl7.repo",
            "sl-extras.repo",
            "sl7-security.repo",
            "sl7-fastbugs.repo",
            "sl7-rolling.repo",
            "sl7-testing.repo"]

          repo { $sl7repos: }

          file { "softwarecollections":
            source => "puppet:///modules/yum/sl7-softwarecollections.repo",
            path   => "/etc/yum.repos.d/sl-softwarecollections.repo",
            owner  => root,
            group  => root,
            mode   => 644,
            ensure => present,
            notify => Exec["yum-clean-all"],
          }

          exec { "yum-autoupdate":
            command => "mv /etc/cron.daily/0yum-daily.cron 
/etc/cron.weekly/0yum-daily.cron",
            onlyif  => "[ -f /etc/cron.daily/0yum-daily.cron ]",
          }

          file { "/etc/cron.daily/0yum-daily.cron": ensure => absent, }

          file { "/etc/cron.weekly/0yum-daily.cron": ensure => present, }
          Exec['yum-autoupdate'] -> File['/etc/cron.daily/0yum-daily.cron'] 
-> File['/etc/cron.weekly/0yum-daily.cron']

        }
      }
    }
    'windows' : {
      exec { 'chocolatelyinstall':
        command  => '$((iex ((new-object 
net.webclient).DownloadString("https://chocolatey.org/install.ps1";)))>$null 
2>&1)',
        unless   => 'if (Test-Path C:\ProgramData\chocolatey){ exit 0 } 
else { exit 1}',
        provider => powershell,
      }

      file { 'chocolatey.config':
        path    => "C:/ProgramData/chocolatey/config/chocolatey.config",
        content => template('yum/chocolatey.config.erb'),
        ensure  => present,
      }

      acl { 'C:/ProgramData/chocolatey/config/chocolatey.config':
        permissions => [
          {
            identity => 'SYSTEM',
            rights   => [
              'full']
          }
          ,
          {
            identity => 'Administrators',
            rights   => [
              'full']
          }
          ,
          {
            identity => 'Users',
            rights   => [
              'read',
              'execute']
          }
          ],
        require     => File['chocolatey.config'],
      }

    }
  }
}




On Monday, September 28, 2015 at 3:19:50 PM UTC-4, Rob Reynolds wrote:
>
> Can you address the yum bit?
>
> On Mon, Sep 28, 2015 at 12:34 PM, jmp242 <[email protected] <javascript:>> 
> wrote:
>
>> And I removed the "target" and put it in the ACL name as you showed, and 
>> get the same error.
>>
>>
>> On Friday, September 25, 2015 at 2:31:43 PM UTC-4, jmp242 wrote:
>>>
>>> I tried with the simplified version:
>>> Enter code here...      acl { 'chocolatey.config':
>>>         target      => 
>>> 'C:/ProgramData/chocolatey/config/chocolatey.config',
>>>         permissions => [
>>>           {
>>>             identity => 'SYSTEM',
>>>             rights   => [
>>>               'full']
>>>           }
>>>           ,
>>>           {
>>>             identity => 'Administrators',
>>>             rights   => [
>>>               'full']
>>>           }
>>>           ,
>>>           {
>>>             identity => 'Users',
>>>             rights   => [
>>>               'read',
>>>               'execute']
>>>           }
>>>           ],
>>>         require     => File['chocolatey.config'],
>>>       }
>>>
>>> I got the same error. Unless the problem is using 
>>> target=>
>>>
>>> I'm at a loss....
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/155fa6b9-2819-4b25-a311-a65a7094e895%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/155fa6b9-2819-4b25-a311-a65a7094e895%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Rob Reynolds
> Developer, Puppet Labs
>
> *PuppetConf 2015 <http://2015.puppetconf.com/>** is right around the 
> corner! Join us October 5-9 in Portland, OR. **Register now 
> <https://puppetconf2015.eventbrite.com/>**.*
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/84a989dc-bf77-43a9-82d1-800ae3b5b73b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to