3 # This module manages the initial configuration of apt.
6 # The parameters listed here are not required in general and were
7 # added for use cases related to development environments.
8 # disable_keys - disables the requirement for all packages to be signed
9 # always_apt_update - rather apt should be updated on every run (intended
10 # for development environments where package updates are frequent
11 # purge_sources_list - Accepts true or false. Defaults to false If set to
12 # true, Puppet will purge all unmanaged entries from sources.list"
13 # purge_sources_list_d - Accepts true or false. Defaults to false. If set
14 # to false, Puppet will purge all unmanaged entries from sources.list.d
23 $always_apt_update = false,
24 $disable_keys = undef,
27 $purge_sources_list = false,
28 $purge_sources_list_d = false
34 validate_bool($purge_sources_list, $purge_sources_list_d)
36 if ! defined(Package['python-software-properties']) {
37 package { 'python-software-properties': }
40 $sources_list_content = $purge_sources_list ? {
42 true => "# Repos managed by puppet.\n",
45 if $always_apt_update == true {
46 Exec <| title=='apt_update' |> {
51 $root = $apt::params::root
52 $apt_conf_d = $apt::params::apt_conf_d
53 $sources_list_d = $apt::params::sources_list_d
54 $provider = $apt::params::provider
56 file { 'sources.list':
58 path => "${root}/sources.list",
62 content => $sources_list_content,
63 notify => Exec['apt_update'],
66 file { 'sources.list.d':
68 path => $sources_list_d,
71 purge => $purge_sources_list_d,
72 recurse => $purge_sources_list_d,
73 notify => Exec['apt_update'],
80 content => "APT::Get::AllowUnauthenticated 1;\n",
81 path => "${apt_conf_d}/99unauth",
87 path => "${apt_conf_d}/99unauth",
90 undef: { } # do nothing
91 default: { fail('Valid values for disable_keys are true or false') }
95 file { 'configure-apt-proxy':
96 path => "${apt_conf_d}/proxy",
97 content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";",
98 notify => Exec['apt_update'],