config.pp 1.43 KB
Newer Older
Emmanuel Medernach's avatar
Emmanuel Medernach committed
1
class yum::config {
2

3 4 5 6 7 8
  file { $yum::reposdir:
    ensure => directory,
    owner => "root",
    mode  => "0755",
  }

9 10 11 12 13
  file { "/etc/yum.conf":
    owner => 'root',
    group => 'root',
    mode => '0644',
    content => template('yum/yum.conf.erb'),
Emmanuel Medernach's avatar
Emmanuel Medernach committed
14
  }
Emmanuel Medernach's avatar
Emmanuel Medernach committed
15 16
  
  if $yum::autoupdate {
Emmanuel Medernach's avatar
Emmanuel Medernach committed
17
    ensure_packages(['yum-cron'], { ensure => 'installed' })
Emmanuel Medernach's avatar
Emmanuel Medernach committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

    file { "/etc/yum/yum-cron.conf":
      ensure  => present,
      source  => "puppet:///modules/yum/yum-cron.conf",
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
    }

    file { "/etc/yum/yum-cron-hourly.conf":
      ensure  => present,
      source  => "puppet:///modules/yum/yum-cron-hourly.conf",
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
    }

    service { 'yum-cron':
      ensure => running,
      enable => true,
    }
  }
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

#  file { '/tmp/debug.yum':
#    owner   => 'root',
#    group   => 'root',
#    mode    => '0644',
#    content => template('yum/debug.erb'),
#  }

  if (is_array($yum::repositories[$yum::profile])) {
    $listofrepos = array2hash($yum::repositories[$yum::profile], $yum::description)

    $newlistofrepos = $listofrepos.map |$key, $value| {
      if (has_key($value, 'descr')) {
        { $key => $value }
        } else {
        { $key => $value + {'descr' => 'Missing descr field in yum::description entry'} }
        }
    }

    $newlistofrepos.each |$repos| {
      create_resources(yumrepo, $repos)
    }
  } 
Emmanuel Medernach's avatar
Emmanuel Medernach committed
63
  
Emmanuel Medernach's avatar
Emmanuel Medernach committed
64
}