ansible-role-nginx/filter_plugins/filters.py

18 lines
450 B
Python
Executable file

#!/usr/bin/env python3
class FilterModule(object):
def filters(self):
return {
'nginx_vhosts_to_certificates': self.nginx_vhosts_to_certificates
}
def nginx_vhosts_to_certificates(self, vhosts):
certs = {}
for i in vhosts.keys():
if not vhosts[i].get('letsencrypt'):
continue
certs['nginx_'+i] = {
'backend': 'letsencrypt',
'san': vhosts[i]['servername'],
'depending_services': ['nginx']
}
return certs