bundlewrap/bundles/postfix/metadata.py
Franziska Kunsmann 3fcd81960e
All checks were successful
bundlewrap/pipeline/head This commit looks good
bundles/postfix: allow configuring mynetworks
2021-03-15 11:41:35 +01:00

74 lines
1.8 KiB
Python

defaults = {
'apt': {
'packages': {
'postfix': {},
},
},
'icinga2_api': {
'postfix': {
'services': {
'POSTFIX PROCESS': {
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_systemd_unit postfix@-',
},
'POSTFIX QUEUE': {
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_postfix_queue -w 20 -c 40 -d 50',
},
},
},
},
'postfix': {
'mynetworks': {
'127.0.0.0/8',
'[::ffff:127.0.0.0]/104',
'[::1]/128',
},
},
}
if node.has_bundle('postfixadmin'):
defaults['backups'] = {
'paths': {
'/var/mail',
},
}
defaults['icinga2_api']['postfix']['services'].update({
'SMTP CONNECT': {
'check_command': 'check_smtp',
'vars.notification.sms': True,
},
'SMTP SUBMISSION CONNECT': {
'check_command': 'check_smtp',
'vars.port': '587',
'vars.notification.sms': True,
},
})
else:
defaults['icinga2_api']['postfix']['services'].update({
'SMTP CONNECT': {
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_smtp -H localhost',
},
})
@metadata_reactor.provides(
'letsencrypt/domains',
'letsencrypt/reload_after',
)
def letsencrypt(metadata):
if not node.has_bundle('letsencrypt') or not node.has_bundle('postfixadmin'):
raise DoNotRunAgain
result = {
'reload_after': {
'postfix',
},
}
result['domains'] = {
metadata.get('postfix/myhostname', metadata.get('hostname')): set(),
}
return {
'letsencrypt': result,
}