paulbsd-salt/states/kopia/config.sls

61 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2023-11-24 19:34:47 +01:00
---
{%- from "kopia/map.jinja" import kopia with context %}
kopia-config-dir:
file.directory:
- name: /etc/kopia
- user: root
- group: root
- mode: 700
2023-12-04 22:33:51 +01:00
kopia-config-sudo:
2023-11-24 19:34:47 +01:00
file.managed:
2023-12-04 22:33:51 +01:00
- name: /etc/sudoers.d/kopia
- source: salt://kopia/templates/kopia_sudo.j2
- template: jinja
2023-11-24 19:34:47 +01:00
- user: root
- group: root
- mode: 600
2023-12-04 22:33:51 +01:00
- 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
2023-11-24 19:34:47 +01:00
- template: jinja
2023-12-04 22:33:51 +01:00
- 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 %}