2020-11-07 21:31:18 +00:00
|
|
|
defaults = {
|
|
|
|
'apt': {
|
|
|
|
'packages': {
|
|
|
|
'postfix': {},
|
|
|
|
},
|
|
|
|
},
|
2020-11-10 09:21:37 +00:00
|
|
|
'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',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-03-15 10:41:35 +00:00
|
|
|
'postfix': {
|
|
|
|
'mynetworks': {
|
|
|
|
'127.0.0.0/8',
|
|
|
|
'[::ffff:127.0.0.0]/104',
|
|
|
|
'[::1]/128',
|
|
|
|
},
|
|
|
|
},
|
2020-11-07 21:31:18 +00:00
|
|
|
}
|
|
|
|
|
2020-11-10 09:21:37 +00:00
|
|
|
if node.has_bundle('postfixadmin'):
|
2020-11-13 11:37:26 +00:00
|
|
|
defaults['backups'] = {
|
|
|
|
'paths': {
|
|
|
|
'/var/mail',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-11-10 09:21:37 +00:00
|
|
|
defaults['icinga2_api']['postfix']['services'].update({
|
|
|
|
'SMTP CONNECT': {
|
|
|
|
'check_command': 'check_smtp',
|
2020-11-22 07:24:44 +00:00
|
|
|
'vars.notification.sms': True,
|
2020-11-10 09:21:37 +00:00
|
|
|
},
|
|
|
|
'SMTP SUBMISSION CONNECT': {
|
|
|
|
'check_command': 'check_smtp',
|
|
|
|
'vars.port': '587',
|
2021-01-02 11:26:37 +00:00
|
|
|
'vars.notification.sms': True,
|
2020-11-10 09:21:37 +00:00
|
|
|
},
|
|
|
|
})
|
|
|
|
else:
|
|
|
|
defaults['icinga2_api']['postfix']['services'].update({
|
|
|
|
'SMTP CONNECT': {
|
|
|
|
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_smtp -H localhost',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2021-01-07 17:44:38 +00:00
|
|
|
@metadata_reactor.provides(
|
|
|
|
'letsencrypt/domains',
|
|
|
|
'letsencrypt/reload_after',
|
|
|
|
)
|
2020-11-07 21:31:18 +00:00
|
|
|
def letsencrypt(metadata):
|
2021-02-20 16:30:38 +00:00
|
|
|
if not node.has_bundle('letsencrypt') or not node.has_bundle('postfixadmin'):
|
2020-11-07 21:31:18 +00:00
|
|
|
raise DoNotRunAgain
|
|
|
|
|
|
|
|
result = {
|
|
|
|
'reload_after': {
|
|
|
|
'postfix',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-02-20 16:30:38 +00:00
|
|
|
result['domains'] = {
|
|
|
|
metadata.get('postfix/myhostname', metadata.get('hostname')): set(),
|
|
|
|
}
|
2020-11-07 21:31:18 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
'letsencrypt': result,
|
|
|
|
}
|