{% set client = salt['grains.filter_by']({ | |
'Debian': { | |
'pkgs': ['backupninja', 'debconf-utils', 'bsd-mailx', 'python-boto', 'rsync'], | |
'service': 'backupninja', | |
'report': {'email': 'root'}, | |
'config': '/etc/default/backupninja', | |
'cacert_file': '/etc/ssl/certs/ca-certificates.crt', | |
'cleanup_backup_directory': True, | |
}, | |
'RedHat': { | |
'pkgs': ['backupninja', 'mailx', 'rsync'], | |
'service': 'backupninja', | |
'report': {'email': 'root'}, | |
'config': '/etc/sysconfig/backupninja', | |
'cacert_file': '/etc/pki/tls/certs/ca-bundle.crt', | |
}, | |
}, merge=salt['pillar.get']('backupninja:client')) %} | |
{% set server = salt['grains.filter_by']({ | |
'Debian': { | |
'pkgs': ['rsync'], | |
'home_dir': '/srv/backupninja', | |
'restrict_clients': True, | |
'keys': [], | |
}, | |
'RedHat': { | |
'pkgs': ['rsync'], | |
'home_dir': '/srv/backupninja', | |
'restrict_clients': True, | |
'keys': [], | |
}, | |
}, merge=salt['pillar.get']('backupninja:server')) %} | |
{%- set service_grains = {'backupninja': {'backup': {}}} %} | |
{%- for service_name, service in pillar.items() %} | |
{%- if service.get('_support', {}).get('backupninja', {}).get('enabled', False) %} | |
{%- set grains_fragment_file = service_name+'/meta/backupninja.yml' %} | |
{%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %} | |
{%- set grains_yaml = load_grains_file()|load_yaml %} | |
{%- if grains_yaml %} | |
{%- set _dummy = service_grains.backupninja.backup.update(grains_yaml.backup) %} | |
{%- endif %} | |
{%- endif %} | |
{%- endfor %} |