From ac76a5d52df78aec919f08334ca5b140902a9298 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sun, 24 Oct 2010 09:07:34 -0400 Subject: Add apt_conf_snippet and use it where possible With the new define, it's easy to add an apt.conf snippet in apt.conf.d It accepts either 'sources' to get a static file or 'content' to define content inline or with the help of a template. Put it to use where we create files in apt.conf.d Finally, fix the dependancy to the apt_config file (however, I don't see the need for this dependancy) Signed-off-by: Gabriel Filion --- manifests/apt_conf_snippet.pp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 manifests/apt_conf_snippet.pp (limited to 'manifests/apt_conf_snippet.pp') diff --git a/manifests/apt_conf_snippet.pp b/manifests/apt_conf_snippet.pp new file mode 100644 index 0000000..77b88ae --- /dev/null +++ b/manifests/apt_conf_snippet.pp @@ -0,0 +1,29 @@ +define apt::apt_conf_snippet( + $ensure = 'present', + $source = '', + $content = undef +){ + if $source == '' and $content == undef { + fail("One of \$source or \$content must be specified for apt_conf_snippet ${name}") + } + if $source != '' and $content != undef { + fail("Only one of \$source or \$content must specified for apt_conf_snippet ${name}") + } + + if $source { + file { "/etc/apt/apt.conf.d/${name}": + ensure => $ensure, + source => $source, + notify => Exec["refresh_apt"], + owner => root, group => 0, mode => 0600; + } + } + else { + file { "/etc/apt/apt.conf.d/${name}": + ensure => $ensure, + content => $content, + notify => Exec["refresh_apt"], + owner => root, group => 0, mode => 0600; + } + } +} -- cgit v1.2.3