manage /etc/apt, use keyring dir
This commit is contained in:
parent
49b05fe8b8
commit
594b7d3c86
2 changed files with 38 additions and 5 deletions
|
@ -5,13 +5,25 @@ from glob import glob
|
||||||
from os.path import join, basename
|
from os.path import join, basename
|
||||||
|
|
||||||
directories = {
|
directories = {
|
||||||
'/etc/apt/sources.list.d': {
|
'/etc/apt': {
|
||||||
'purge': True,
|
'purge': True,
|
||||||
'triggers': {
|
'triggers': {
|
||||||
'action:apt_update',
|
'action:apt_update',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'/etc/apt/trusted.gpg.d': {
|
'/etc/apt/apt.conf.d': {
|
||||||
|
'triggers': {
|
||||||
|
'action:apt_update',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'/etc/apt/keyrings': {
|
||||||
|
# https://askubuntu.com/a/1307181
|
||||||
|
'purge': True,
|
||||||
|
'triggers': {
|
||||||
|
'action:apt_update',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'/etc/apt/listchanges.conf.d': {
|
||||||
'purge': True,
|
'purge': True,
|
||||||
'triggers': {
|
'triggers': {
|
||||||
'action:apt_update',
|
'action:apt_update',
|
||||||
|
@ -23,11 +35,20 @@ directories = {
|
||||||
'action:apt_update',
|
'action:apt_update',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'/etc/apt/sources.list.d': {
|
||||||
|
'purge': True,
|
||||||
|
'triggers': {
|
||||||
|
'action:apt_update',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
'/etc/apt/sources.list': {
|
'/etc/apt/listchanges.conf.d/managed.conf': {
|
||||||
'content': '# managed'
|
'content': repo.libs.ini.dumps(node.metadata.get('apt/list_changes')),
|
||||||
|
},
|
||||||
|
'/etc/apt/trusted.gpg.d': {
|
||||||
|
'delete': True,
|
||||||
},
|
},
|
||||||
'/usr/lib/nagios/plugins/check_apt_upgradable': {
|
'/usr/lib/nagios/plugins/check_apt_upgradable': {
|
||||||
'mode': '0755',
|
'mode': '0755',
|
||||||
|
@ -61,7 +82,7 @@ for host, sources in hosts.items():
|
||||||
paths = glob(join(repo.path, 'data', 'apt', 'keys', f'{host}.*'))
|
paths = glob(join(repo.path, 'data', 'apt', 'keys', f'{host}.*'))
|
||||||
assert len(paths) == 1
|
assert len(paths) == 1
|
||||||
keyfile = basename(paths[0])
|
keyfile = basename(paths[0])
|
||||||
destination_path = f'/etc/apt/trusted.gpg.d/{keyfile}'
|
destination_path = f'/etc/apt/keyrings/{keyfile}'
|
||||||
|
|
||||||
for source in sources:
|
for source in sources:
|
||||||
source.options['signed-by'] = [destination_path]
|
source.options['signed-by'] = [destination_path]
|
||||||
|
|
|
@ -4,6 +4,18 @@ defaults = {
|
||||||
'unattended-upgrades': {},
|
'unattended-upgrades': {},
|
||||||
},
|
},
|
||||||
'sources': set(),
|
'sources': set(),
|
||||||
|
'list_changes': {
|
||||||
|
'apt': {
|
||||||
|
'frontend': 'pager',
|
||||||
|
'which': 'news',
|
||||||
|
'email_address': 'root',
|
||||||
|
'email_format': 'text',
|
||||||
|
'confirm': 'false',
|
||||||
|
'headers': 'false',
|
||||||
|
'reverse': 'false',
|
||||||
|
'save_seen': '/var/lib/apt/listchanges.db',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'monitoring': {
|
'monitoring': {
|
||||||
'services': {
|
'services': {
|
||||||
|
|
Loading…
Reference in a new issue