Added Debian components
* added debian components for Debian12 and Debian11 * added apt module to puppetfile * removed /etc/apt/sources.list management, done by apt module * added profiles::apt::puppet7
This commit is contained in:
@@ -22,9 +22,7 @@
|
||||
# Manages all .list files under /etc/apt/sources.list.d. All the repositories listed
|
||||
# in $managed_repos will have their corresponding .list files preserved. Any
|
||||
# .list file that is not listed in $managed_repos will be removed.
|
||||
# Creates and maintains a /etc/apt/sources.list.d/.managed file that lists all the
|
||||
# .list files that should be managed by Puppet.
|
||||
# Manages /etc/apt/sources.list file to include the .list files in /etc/apt/sources.list.d.
|
||||
# Manages /etc/apt/sources.list file to be empty.
|
||||
#
|
||||
# Example usage:
|
||||
# --------------
|
||||
@@ -41,7 +39,12 @@ class profiles::apt::global (
|
||||
Array[String] $components = lookup('profiles::apt::components'),
|
||||
){
|
||||
class { 'apt':
|
||||
update => {
|
||||
sources_list_force => true,
|
||||
purge => {
|
||||
'sources.list' => true,
|
||||
'sources.list.d' => true,
|
||||
},
|
||||
update => {
|
||||
frequency => 'daily',
|
||||
loglevel => 'debug',
|
||||
},
|
||||
@@ -54,35 +57,6 @@ class profiles::apt::global (
|
||||
},
|
||||
}
|
||||
|
||||
# Generate the content for the .managed file
|
||||
$managed_file_content = $managed_repos.map |$repo_name| { "${repo_name}.repo" }.join("\n")
|
||||
|
||||
# Create the .managed file
|
||||
file { '/etc/apt/sources.list.d/.managed':
|
||||
ensure => file,
|
||||
content => $managed_file_content,
|
||||
}
|
||||
|
||||
# Define exec resource to remove .list files not listed in .managed
|
||||
exec { 'cleanup_apt_repos':
|
||||
command => '/bin/bash -c "comm -23 <(ls /etc/apt/sources.list.d | sort)
|
||||
<(sort /etc/apt/sources.list.d/.managed) |
|
||||
xargs -n1 rm -f /etc/apt/sources.list.d/{}"',
|
||||
path => ['/bin', '/usr/bin'],
|
||||
onlyif => '/bin/bash -c "comm -23 <(ls /etc/apt/sources.list.d | sort)
|
||||
<(sort /etc/apt/sources.list.d/.managed) | grep .list"',
|
||||
}
|
||||
|
||||
file { '/etc/apt/sources.list':
|
||||
ensure => 'file',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => @(END)
|
||||
## Apt is managed by Puppet, do not edit this file
|
||||
END
|
||||
}
|
||||
|
||||
# Setup base repos
|
||||
class { 'profiles::apt::base':
|
||||
managed_repos => $managed_repos,
|
||||
@@ -92,6 +66,5 @@ class profiles::apt::global (
|
||||
# Setup puppet7 if included in managed_repos
|
||||
class { 'profiles::apt::puppet7':
|
||||
managed_repos => $managed_repos,
|
||||
components => $components,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user