--- {%- from "kopia/map.jinja" import kopia with context %} kopia-config-dir: file.directory: - name: /etc/kopia - user: root - group: root - mode: 700 kopia-config-sudo: file.managed: - name: /etc/sudoers.d/kopia - source: salt://kopia/templates/kopia_sudo.j2 - template: jinja - user: root - group: root - mode: 600 - check_cmd: /usr/sbin/visudo -c -f {% for name, params in kopia.jobs.items() %} kopia-config-{{ name }}: file.directory: - name: /etc/kopia/{{ name }} - user: root - group: root - mode: 700 - require: - file: kopia-config-dir kopia-config-{{ name }}-run: file.managed: - name: /etc/kopia/{{ name }}/backup.py - source: salt://kopia/templates/kopia_backup.py.j2 - user: root - group: root - mode: 700 - template: jinja - context: name: {{ name }} params: {{ params }} - require: - file: kopia-config-dir - file: kopia-config-{{ name }} {% for dir in params.dirs %} {% if "ignore" in dir.keys() %} kopia-config-{{ name }}-{{ dir.path }}-ignore: file.managed: - name: {{ dir.path }}/.kopiaignore - source: salt://kopia/templates/kopiaignore.j2 - user: root - group: root - mode: 700 - template: jinja - context: ignore: {{ dir.ignore }} {% endif %} {% endfor %} {% endfor %}