DS
jhgfdfgh555kkk
Выстави frequency в классе apt
Size: a a a
DS
A
DS
# лучше через hiera задать параметры и сделать include apt
class { 'apt':
update => {
frequency => 'daily',
},
}
Class['apt::update'] -> ensure_packages(['curl','wget'])
A
A
A
DS
DS
exec {'apt-get update':
command => 'apt-get update',
path => ['/usr/bin', '/bin'],
unless => "dpkg -s ${package_name}",
before => Package[$package_name]
}DS
exec {'apt-get update':
command => 'apt-get update',
path => ['/usr/bin', '/bin'],
unless => "dpkg -s wget && dpkg -s curl",
before => Package['wget', 'curl']
}A
A
A
A
A
A
DS
DS
$packages = ['wget', 'curl']
$check_packages = $packages.map|$p| {"dpkg -s ${p}"}.join(' && ')
exec { 'apt-get update':
command => 'apt-get update',
path => ['/usr/bin', '/bin'],
unless => $check_packages,
before => Package[$packages]
}
ensure_packages($packages, {
ensure => 'present'
})
DS
DS
ensure_packages($packages, {
ensure => 'present',
require => Exec['apt-get update'],
})
```